[nautilus] file: make sure not to pass g_utf8_collate() NULL strings



commit 3645b11f392c649455472bc1b3a8c8f581c37c74
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Fri Feb 25 13:18:11 2011 -0500

    file: make sure not to pass g_utf8_collate() NULL strings

 libnautilus-private/nautilus-file.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/libnautilus-private/nautilus-file.c b/libnautilus-private/nautilus-file.c
index 3d14216..a7a0e76 100644
--- a/libnautilus-private/nautilus-file.c
+++ b/libnautilus-private/nautilus-file.c
@@ -2981,6 +2981,18 @@ compare_by_type (NautilusFile *file_1, NautilusFile *file_2)
 	type_string_1 = nautilus_file_get_type_as_string (file_1);
 	type_string_2 = nautilus_file_get_type_as_string (file_2);
 
+	if (type_string_1 == NULL || type_string_2 == NULL) {
+		if (type_string_1 != NULL) {
+			return -1;
+		}
+
+		if (type_string_2 != NULL) {
+			return 1;
+		}
+
+		return 0;
+	}
+
 	result = g_utf8_collate (type_string_1, type_string_2);
 
 	g_free (type_string_1);



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