summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPablo Barciela <[email protected]>2019-03-28 04:44:36 +0100
committermonsta <[email protected]>2019-07-23 16:11:43 +0300
commit32b41e72a508636947fc3c107caf504fe74da224 (patch)
treedbdc7fba8bd17e0db9f8d567b7ec62e36f21f627
parente4596d56b206d86f0b51948ad58eb2c8bf62f821 (diff)
downloadcaja-32b41e72a508636947fc3c107caf504fe74da224.tar.bz2
caja-32b41e72a508636947fc3c107caf504fe74da224.tar.xz
caja-open-with-dialog: make sure there is error before showing it
Fixes Clang static analyzer warning: caja-open-with-dialog.c:252:100: warning: Access to field 'message' results in a dereference of a null pointer (loaded from variable 'error') message = g_strdup_printf (_("Could not add application to the application database: %s"), error->message); ^~~~~~~~~~~~~~
-rw-r--r--libcaja-private/caja-open-with-dialog.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/libcaja-private/caja-open-with-dialog.c b/libcaja-private/caja-open-with-dialog.c
index 45996fdf..e42a8fbd 100644
--- a/libcaja-private/caja-open-with-dialog.c
+++ b/libcaja-private/caja-open-with-dialog.c
@@ -249,12 +249,15 @@ add_or_find_application (CajaOpenWithDialog *dialog)
if (app == NULL)
{
- message = g_strdup_printf (_("Could not add application to the application database: %s"), error->message);
+ message = g_strdup_printf (_("Could not add application to the application database: %s"), error ? error->message : _("Unknown error"));
eel_show_error_dialog (_("Could not add application"),
message,
GTK_WINDOW (dialog));
g_free (message);
- g_error_free (error);
+
+ if (error)
+ g_error_free (error);
+
return NULL;
}