summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPablo Barciela <[email protected]>2019-04-12 19:38:16 +0200
committerraveit65 <[email protected]>2019-04-16 16:22:40 +0200
commit238abcc94644169c9716c12901c14429767637d0 (patch)
tree393a017e28c5e780a15226fa2cc7120b114e8b83 /src
parent46e73ec24b89415e260faf0280795f3a8e436237 (diff)
downloadcaja-238abcc94644169c9716c12901c14429767637d0.tar.bz2
caja-238abcc94644169c9716c12901c14429767637d0.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; ^~~~~~~~~~~~~~~
Diffstat (limited to 'src')
-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 fadeb5a1..d94a56db 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 ());