diff options
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/shell_integration_linux.cc | 4 | ||||
-rw-r--r-- | chrome/browser/shell_integration_unittest.cc | 4 |
2 files changed, 7 insertions, 1 deletions
diff --git a/chrome/browser/shell_integration_linux.cc b/chrome/browser/shell_integration_linux.cc index 326a93e..2a656fe 100644 --- a/chrome/browser/shell_integration_linux.cc +++ b/chrome/browser/shell_integration_linux.cc @@ -639,6 +639,7 @@ std::string GetDesktopFileContents( // Although not required by the spec, Nautilus on Ubuntu Karmic creates its // launchers with an xdg-open shebang. Follow that convention. std::string output_buffer = std::string(kXdgOpenShebang) + "\n"; + // An empty file causes a crash with glib <= 2.32, so special case here. if (template_contents.empty()) return output_buffer; @@ -654,8 +655,9 @@ std::string GetDesktopFileContents( template_contents.size(), G_KEY_FILE_NONE, &err)) { - NOTREACHED() << "Unable to read desktop file template:" << err->message; + LOG(WARNING) << "Unable to read desktop file template: " << err->message; g_error_free(err); + g_key_file_free(key_file); return output_buffer; } diff --git a/chrome/browser/shell_integration_unittest.cc b/chrome/browser/shell_integration_unittest.cc index 30df2d4..0b81311 100644 --- a/chrome/browser/shell_integration_unittest.cc +++ b/chrome/browser/shell_integration_unittest.cc @@ -391,6 +391,10 @@ TEST(ShellIntegrationTest, GetDesktopFileContents) { // Dumb case. { "ignored", "ignored", "ignored", false, "", "#!/usr/bin/env xdg-open\n" }, + // Invalid desktop file. + { "ignored", "ignored", "ignored", false, "[Desktop\n", + "#!/usr/bin/env xdg-open\n" }, + // Non-empty file without [Desktop Entry]. // This tests a different code path to the above. { "http://gmail.com", |