diff options
author | Corey Berla <corey@berla.me> | 2023-01-22 21:13:02 -0800 |
---|---|---|
committer | Corey Berla <corey@berla.me> | 2023-01-23 15:42:08 -0800 |
commit | a72031b2e73dd8512b3f295e8575d633dd69dcfd (patch) | |
tree | b44d2b5277287e1745c947d3f4d5bebdabf8e74c | |
parent | 2abc6eb38d01c9d781743b48e9be3b7eed99c319 (diff) | |
download | nautilus-a72031b2e73dd8512b3f295e8575d633dd69dcfd.tar.gz |
dnd: Fix dnd_get_preferred_action for non-local drops
With non-local drops, when the value is initially NULL, we get
warnings because of some of the checks done on a NULL value. This was
a regression from 3d17ed252960cbc9848aea0b398a4a74ef05623c. Return
action copy before any check dependent on a dropped value.
-rw-r--r-- | src/nautilus-dnd.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/nautilus-dnd.c b/src/nautilus-dnd.c index cd6fd110d..5e6cfead0 100644 --- a/src/nautilus-dnd.c +++ b/src/nautilus-dnd.c @@ -174,10 +174,11 @@ nautilus_dnd_get_preferred_action (NautilusFile *target_file, gboolean source_deletable; g_return_val_if_fail (NAUTILUS_IS_FILE (target_file), 0); + /* With non-local drops, it's normal for dropped to initially be NULL */ g_return_val_if_fail (dropped == NULL || G_IS_FILE (dropped), 0); target_location = nautilus_file_get_location (target_file); - if (g_file_equal (target_location, dropped)) + if (dropped != NULL && g_file_equal (target_location, dropped)) { return 0; } @@ -214,6 +215,11 @@ nautilus_dnd_get_preferred_action (NautilusFile *target_file, return GDK_ACTION_MOVE; } + if (dropped == NULL) + { + return GDK_ACTION_COPY; + } + if (g_file_has_uri_scheme (dropped, "trash")) { return GDK_ACTION_MOVE; |