From f8ed2af9510cb20f2ad8101aeaab5c6458ade0d7 Mon Sep 17 00:00:00 2001 From: monsta Date: Thu, 17 Sep 2015 11:36:03 +0300 Subject: undostack: don't try restoring files w/o "trash::orig-path" attribute fixes https://github.com/mate-desktop/caja/issues/361 --- libcaja-private/caja-undostack-manager.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libcaja-private/caja-undostack-manager.c b/libcaja-private/caja-undostack-manager.c index eff05a10..f989add3 100644 --- a/libcaja-private/caja-undostack-manager.c +++ b/libcaja-private/caja-undostack-manager.c @@ -1986,6 +1986,11 @@ retrieve_files_to_restore (GHashTable * trashed) while ((info = g_file_enumerator_next_file (enumerator, NULL, NULL)) != NULL) { /* Retrieve the original file uri */ const char *origpath = g_file_info_get_attribute_byte_string (info, G_FILE_ATTRIBUTE_TRASH_ORIG_PATH); + if (origpath == NULL) { + g_warning ("The item cannot be restored from trash: could not determine original location"); + continue; + } + GFile *origfile = g_file_new_for_path (origpath); char *origuri = g_file_get_uri (origfile); g_object_unref (origfile); -- cgit v1.2.1