diff options
author | Ernestas Kulik <ernestask@gnome.org> | 2017-08-11 19:57:32 +0300 |
---|---|---|
committer | Ernestas Kulik <ernestask@gnome.org> | 2017-08-11 22:15:51 +0300 |
commit | cd78b1c9863a25a5fae0f2f7f98ca6d58681cbd6 (patch) | |
tree | eef47b9327c9b65448b44d01b63952ce4e5290d6 /src/nautilus-mime-actions.c | |
parent | cd462d216383e02507f5268bed3c29e61c4d8510 (diff) | |
download | nautilus-cd78b1c9863a25a5fae0f2f7f98ca6d58681cbd6.tar.gz |
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
Diffstat (limited to 'src/nautilus-mime-actions.c')
-rw-r--r-- | src/nautilus-mime-actions.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/nautilus-mime-actions.c b/src/nautilus-mime-actions.c index 28f1da54a..18066d617 100644 --- a/src/nautilus-mime-actions.c +++ b/src/nautilus-mime-actions.c @@ -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; |