[nautilus] Don't crash if we can't load column preferences



commit 185dad3c3ace1e6f11897b5e7c11d083a378785b
Author: William Jon McCann <jmccann redhat com>
Date:   Tue Sep 4 20:21:55 2012 -0400

    Don't crash if we can't load column preferences
    
    https://bugzilla.gnome.org/show_bug.cgi?id=662131

 libnautilus-private/nautilus-column-utilities.c |    6 +++---
 src/nautilus-list-view.c                        |   10 ++++++----
 2 files changed, 9 insertions(+), 7 deletions(-)
---
diff --git a/libnautilus-private/nautilus-column-utilities.c b/libnautilus-private/nautilus-column-utilities.c
index d328ab1..ea8aad2 100644
--- a/libnautilus-private/nautilus-column-utilities.c
+++ b/libnautilus-private/nautilus-column-utilities.c
@@ -337,12 +337,12 @@ GList *
 nautilus_sort_columns (GList  *columns, 
 		       char  **column_order)
 {
-	if (!column_order) {
-		return NULL;
+	if (column_order == NULL) {
+		return columns;
 	}
 
 	return g_list_sort_with_data (columns,
 				      (GCompareDataFunc)column_compare,
 				      column_order);
 }
-		       
+
diff --git a/src/nautilus-list-view.c b/src/nautilus-list-view.c
index 25fd2e5..e1d8e34 100644
--- a/src/nautilus-list-view.c
+++ b/src/nautilus-list-view.c
@@ -1249,10 +1249,12 @@ apply_columns_settings (NautilusListView *list_view,
 						      g_str_equal,
 						      (GDestroyNotify) g_free,
 						      (GDestroyNotify) g_free);
-	for (i = 0; visible_columns[i] != NULL; ++i) {
-		g_hash_table_insert (visible_columns_hash,
-				     g_ascii_strdown (visible_columns[i], -1),
-				     g_ascii_strdown (visible_columns[i], -1));
+	if (visible_columns != NULL) {
+		for (i = 0; visible_columns[i] != NULL; ++i) {
+			g_hash_table_insert (visible_columns_hash,
+					     g_ascii_strdown (visible_columns[i], -1),
+					     g_ascii_strdown (visible_columns[i], -1));
+		}
 	}
 
 	for (l = all_columns; l != NULL; l = l->next) {



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