diff options
author | benjhayden@chromium.org <benjhayden@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-20 17:15:43 +0000 |
---|---|---|
committer | benjhayden@chromium.org <benjhayden@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-20 17:15:43 +0000 |
commit | 9dc6e59d74cdd678cb47d9d2e4bc8b462872bb82 (patch) | |
tree | 502b304401b94c9e85a86198c414a029b0fecb13 /base/nix | |
parent | 6b4783a97c17881e7eab5ebb87c4e5d50575c63a (diff) | |
download | chromium_src-9dc6e59d74cdd678cb47d9d2e4bc8b462872bb82.zip chromium_src-9dc6e59d74cdd678cb47d9d2e4bc8b462872bb82.tar.gz chromium_src-9dc6e59d74cdd678cb47d9d2e4bc8b462872bb82.tar.bz2 |
Prevent crashes in mime_util_xdg.
Review URL: https://chromiumcodereview.appspot.com/10831337
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@152347 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/nix')
-rw-r--r-- | base/nix/mime_util_xdg.cc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/base/nix/mime_util_xdg.cc b/base/nix/mime_util_xdg.cc index 030c30c..e58e03d 100644 --- a/base/nix/mime_util_xdg.cc +++ b/base/nix/mime_util_xdg.cc @@ -588,6 +588,8 @@ namespace base { namespace nix { std::string GetFileMimeType(const FilePath& filepath) { + if (filepath.empty()) + return std::string(); base::ThreadRestrictions::AssertIOAllowed(); base::AutoLock scoped_lock(g_mime_util_xdg_lock.Get()); return xdg_mime_get_mime_type_from_file_name(filepath.value().c_str()); @@ -625,7 +627,7 @@ FilePath GetMimeIcon(const std::string& mime_type, size_t size) { std::string icon_name; FilePath icon_file; - { + if (!mime_type.empty()) { base::AutoLock scoped_lock(g_mime_util_xdg_lock.Get()); const char *icon = xdg_mime_get_icon(mime_type.c_str()); icon_name = std::string(icon ? icon : ""); |