mime-actions: null-check app info

When deciding on the activation action, the code checks if Nautilus
is the default handler for archives. There are cases when the returned
application info is invalid, e.g. for application/octet-stream.

https://bugzilla.gnome.org/show_bug.cgi?id=786168
This commit is contained in:
Ernestas Kulik 2017-08-11 19:57:32 +03:00
parent cd462d2163
commit cd78b1c986

View file

@ -710,13 +710,16 @@ get_activation_action (NautilusFile *file)
{
ActivationAction action;
char *activation_uri;
gboolean handles_extract;
gboolean handles_extract = FALSE;
g_autoptr (GAppInfo) app_info = NULL;
const gchar* app_id;
app_info = nautilus_mime_get_default_application_for_file (file);
app_id = g_app_info_get_id (app_info);
handles_extract = g_strcmp0 (app_id, NAUTILUS_DESKTOP_ID) == 0;
if (app_info != NULL)
{
app_id = g_app_info_get_id (app_info);
handles_extract = g_strcmp0 (app_id, NAUTILUS_DESKTOP_ID) == 0;
}
if (handles_extract && nautilus_file_is_archive (file))
{
return ACTIVATION_ACTION_EXTRACT;