Fixed more crashes when MIME database is not initialized
This commit is contained in:
parent
cf27f07836
commit
e2c4a1a05f
@ -1036,7 +1036,10 @@ void browser_set_location(Browser * browser, char const * path)
|
||||
if((realpath = _location_real_path(path)) == NULL)
|
||||
return;
|
||||
if(g_file_test(realpath, G_FILE_TEST_IS_REGULAR))
|
||||
mime_action(browser->mime, "open", realpath);
|
||||
{
|
||||
if(browser->mime != NULL)
|
||||
mime_action(browser->mime, "open", realpath);
|
||||
}
|
||||
else if(g_file_test(realpath, G_FILE_TEST_IS_DIR)
|
||||
&& _location_directory(browser, realpath) == 0)
|
||||
{
|
||||
|
@ -703,7 +703,7 @@ static void _default_do(Browser * browser, GtkTreePath * path)
|
||||
&location, BR_COL_IS_DIRECTORY, &is_dir, -1);
|
||||
if(is_dir)
|
||||
browser_set_location(browser, location);
|
||||
else
|
||||
else if(browser->mime != NULL)
|
||||
mime_action(browser->mime, "open", location);
|
||||
g_free(location);
|
||||
}
|
||||
@ -968,7 +968,7 @@ static void _press_mime(Mime * mime, char const * mimetype, char const * action,
|
||||
{
|
||||
GtkWidget * menuitem;
|
||||
|
||||
if(mime_get_handler(mime, mimetype, action) == NULL)
|
||||
if(mime == NULL || mime_get_handler(mime, mimetype, action) == NULL)
|
||||
return;
|
||||
if(strncmp(label, "gtk-", 4) == 0)
|
||||
menuitem = gtk_image_menu_item_new_from_stock(label, NULL);
|
||||
@ -1009,7 +1009,7 @@ static void _on_icon_open(GtkWidget * widget, gpointer data)
|
||||
|
||||
if(cb->isdir)
|
||||
browser_set_location(cb->browser, cb->path);
|
||||
else
|
||||
else if(cb->browser->mime != NULL)
|
||||
mime_action(cb->browser->mime, "open", cb->path);
|
||||
}
|
||||
|
||||
@ -1017,7 +1017,8 @@ static void _on_icon_edit(GtkWidget * widget, gpointer data)
|
||||
{
|
||||
IconCallback * cb = data;
|
||||
|
||||
mime_action(cb->browser->mime, "edit", cb->path);
|
||||
if(cb->browser->mime != NULL)
|
||||
mime_action(cb->browser->mime, "edit", cb->path);
|
||||
}
|
||||
|
||||
static void _on_icon_open_with(GtkWidget * widget, gpointer data)
|
||||
|
Loading…
Reference in New Issue
Block a user