[nautilus] shell-search-provider: warn against NULL strings before normalizing



commit 7427ee626e32d8bbe7d607c96a25f686b64df365
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Tue Sep 25 14:36:32 2012 -0400

    shell-search-provider: warn against NULL strings before normalizing
    
    Since g_mount_get_name() and nautilus_bookmark_get_name() can possibly
    return NULL, warn against it before normalizing the string and trying to
    compare it with the search terms. This fixes a crasher in the shell
    search provider.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=684807

 src/nautilus-shell-search-provider.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/src/nautilus-shell-search-provider.c b/src/nautilus-shell-search-provider.c
index 552a30f..6d4291e 100644
--- a/src/nautilus-shell-search-provider.c
+++ b/src/nautilus-shell-search-provider.c
@@ -315,6 +315,9 @@ search_add_volumes_and_bookmarks (NautilusShellSearchProviderApp *self)
     bookmark = nautilus_bookmark_list_item_at (self->bookmarks, idx);
 
     name = nautilus_bookmark_get_name (bookmark);
+    if (name == NULL)
+      continue;
+
     prepared = prepare_string_for_compare (name);
 
     found = TRUE;
@@ -393,6 +396,9 @@ search_add_volumes_and_bookmarks (NautilusShellSearchProviderApp *self)
     mount = l->data;
 
     query_text = g_mount_get_name (mount);
+    if (query_text == NULL)
+      continue;
+
     prepared = prepare_string_for_compare (query_text);
     g_free (query_text);
 



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