[nautilus] shell-search-provider: don't crash if file doesn't have path



commit 6721483eb713915b2fb07cf8dc830bdea3211fd3
Author: Carlos Soriano <csoriano gnome org>
Date:   Thu Mar 3 16:34:37 2016 +0100

    shell-search-provider: don't crash if file doesn't have path
    
    Some backends doesn't support g_file_get_path, like the trash backends,
    and we were crashing trying to create a description with a NULL path.
    
    For those, just use the uri as a description.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=762076

 src/nautilus-shell-search-provider.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/src/nautilus-shell-search-provider.c b/src/nautilus-shell-search-provider.c
index cec51c0..27963f0 100644
--- a/src/nautilus-shell-search-provider.c
+++ b/src/nautilus-shell-search-provider.c
@@ -546,8 +546,9 @@ result_list_attributes_ready_cb (GList    *file_list,
                            "id", g_variant_new_string (uri));
     g_variant_builder_add (&meta, "{sv}",
                            "name", g_variant_new_string (display_name));
+    /* Some backends like trash:/// don't have a path, so we show the uri itself. */
     g_variant_builder_add (&meta, "{sv}",
-                           "description", g_variant_new_string (description));
+                           "description", g_variant_new_string (description? description : uri));
 
     gicon = NULL;
     thumbnail_path = nautilus_file_get_thumbnail_path (file);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]