From 11c25a37db29177f4d1cd696b3b4ddd72f9fed4d Mon Sep 17 00:00:00 2001 From: Ondrej Holy Date: Fri, 17 Mar 2023 12:44:51 +0100 Subject: pathbar: Initialize drag action MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The `‘action’ may be used uninitialized` warning is shown during build currently. It can really happen that uninitialized value is used when dropping something else then `GDK_TYPE_FILE_LIST` on the pathbar. Let's initialize the action to prevent this. --- src/nautilus-pathbar.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/nautilus-pathbar.c b/src/nautilus-pathbar.c index 1b6ea6a47..7e19e2448 100644 --- a/src/nautilus-pathbar.c +++ b/src/nautilus-pathbar.c @@ -746,7 +746,7 @@ on_drag_motion (GtkDropTarget *target, gpointer user_data) { ButtonData *button_data = user_data; - GdkDragAction action; + GdkDragAction action = 0; const GValue *value; graphene_point_t start; @@ -759,12 +759,7 @@ on_drag_motion (GtkDropTarget *target, if (G_VALUE_HOLDS (value, GDK_TYPE_FILE_LIST)) { GSList *items = g_value_get_boxed (value); - - if (items == NULL) - { - action = 0; - } - else + if (items != NULL) { action = nautilus_dnd_get_preferred_action (button_data->file, items->data); } -- cgit v1.2.1