summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPablo Barciela <[email protected]>2019-04-12 19:38:16 +0200
committerraveit65 <[email protected]>2022-07-19 23:35:19 +0200
commit735a38e23c0cd67fefc25e6d13f26a187b56ea32 (patch)
treed88dcaf16a3764290a3a1c3a41a76c50ddf0e918
parent8b1339ed071e9a031c4a9e4c41cea113967ac44b (diff)
downloadcaja-735a38e23c0cd67fefc25e6d13f26a187b56ea32.tar.bz2
caja-735a38e23c0cd67fefc25e6d13f26a187b56ea32.tar.xz
caja-location-dialog: Fix 'cppcheck' and 'clang' warnings
Fixes 'cppcheck' warnings: [src/caja-location-dialog.c:229] -> [src/caja-location-dialog.c:237]: (warning) Either the condition 'window' is redundant or there is possible null pointer dereference: window. [src/caja-location-dialog.c:224]: (style) The scope of the variable 'formatted_location' can be reduced. Fixes Clang static analyzer warning: caja-location-dialog.c:237:12: warning: Access to field 'details' results in a dereference of a null pointer (loaded from variable 'window') slot = window->details->active_pane->active_slot; ^~~~~~~~~~~~~~~
-rw-r--r--src/caja-location-dialog.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/caja-location-dialog.c b/src/caja-location-dialog.c
index a341b48b..d7925ab3 100644
--- a/src/caja-location-dialog.c
+++ b/src/caja-location-dialog.c
@@ -217,11 +217,9 @@ caja_location_dialog_init (CajaLocationDialog *dialog)
GtkWidget *
caja_location_dialog_new (CajaWindow *window)
{
- CajaWindowSlot *slot;
CajaLocationDialog *loc_dialog;
GtkWidget *dialog;
GFile *location;
- char *formatted_location;
dialog = gtk_widget_new (CAJA_TYPE_LOCATION_DIALOG, NULL);
loc_dialog = CAJA_LOCATION_DIALOG (dialog);
@@ -232,13 +230,15 @@ caja_location_dialog_new (CajaWindow *window)
gtk_window_set_screen (GTK_WINDOW (dialog),
gtk_window_get_screen (GTK_WINDOW (window)));
loc_dialog->details->window = window;
+ location = window->details->active_pane->active_slot->location;
}
+ else
+ location = NULL;
- slot = window->details->active_pane->active_slot;
-
- location = slot->location;
if (location != NULL)
{
+ char *formatted_location;
+
if (CAJA_IS_DESKTOP_WINDOW (window))
{
formatted_location = g_strdup_printf ("%s/", g_get_home_dir ());