changeset 2718:1f7df2206412

Bug fix: Bookmark DnD In some cases dragging-and-dropping something that is not a URI to create a bookmark will cause Geeqie to crash.
author Colin Clark <colin.clark@cclark.uk>
date Tue, 23 Jan 2018 19:48:24 +0000
parents 4903104ff447
children 13e542066941
files src/ui_bookmark.c
diffstat 1 files changed, 26 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/src/ui_bookmark.c	Tue Jan 23 00:40:57 2018 +0100
+++ b/src/ui_bookmark.c	Tue Jan 23 19:48:24 2018 +0000
@@ -731,32 +731,35 @@
 
 	if (!bm->editable) return;
 
-	uris = gtk_selection_data_get_uris(selection_data);
-	list = uri_pathlist_from_uris(uris, &errors);
-	if(errors)
-		{
-		warning_dialog_dnd_uri_error(errors);
-		string_list_free(errors);
-		}
-	g_strfreev(uris);
-
-	work = list;
-	while (work)
+ 	uris = gtk_selection_data_get_uris(selection_data);
+ 	if (uris)
 		{
-		gchar *path = work->data;
-		gchar *buf;
-
-		work = work->next;
+		list = uri_pathlist_from_uris(uris, &errors);
+		if(errors)
+			{
+			warning_dialog_dnd_uri_error(errors);
+			string_list_free(errors);
+			}
+		g_strfreev(uris);
 
-		if (bm->only_directories && !isdir(path)) continue;
-		buf = bookmark_string(filename_from_path(path), path, NULL);
-		history_list_add_to_key(bm->key, buf, 0);
-		g_free(buf);
+		work = list;
+		while (work)
+			{
+			gchar *path = work->data;
+			gchar *buf;
+
+			work = work->next;
+
+			if (bm->only_directories && !isdir(path)) continue;
+			buf = bookmark_string(filename_from_path(path), path, NULL);
+			history_list_add_to_key(bm->key, buf, 0);
+			g_free(buf);
+			}
+
+		string_list_free(list);
+
+		bookmark_populate_all(bm->key);
 		}
-
-	string_list_free(list);
-
-	bookmark_populate_all(bm->key);
 }
 
 static void bookmark_list_destroy(GtkWidget *widget, gpointer data)