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
parent 6b4783a9
......@@ -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 : "");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment