[evolution-patches] fix for a composer-prefs bug



Just added some NULL-protection, otherwise we get a crash if we have no
languages config'd.

Jeff

-- 
Jeffrey Stedfast
Evolution Hacker - Ximian, Inc.
fejj ximian com  - www.ximian.com
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/mail/ChangeLog,v
retrieving revision 1.2701
diff -u -r1.2701 ChangeLog
--- ChangeLog	18 Apr 2003 18:07:03 -0000	1.2701
+++ ChangeLog	18 Apr 2003 22:10:40 -0000
@@ -1,3 +1,8 @@
+2003-04-18  Jeffrey Stedfast  <fejj ximian com>
+
+	* mail-composer-prefs.c (spell_set_ui): Protect against a NULL
+	strv result from parsing the language list string.
+
 2003-04-17  Jeffrey Stedfast  <fejj ximian com>
 
 	Fixes for bug #41142.
Index: mail-composer-prefs.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/mail-composer-prefs.c,v
retrieving revision 1.60
diff -u -r1.60 mail-composer-prefs.c
--- mail-composer-prefs.c	7 Apr 2003 19:10:23 -0000	1.60
+++ mail-composer-prefs.c	18 Apr 2003 22:10:40 -0000
@@ -492,16 +492,17 @@
 	GtkTreeIter iter;
 	GHashTable *present;
 	gboolean go;
-	char **strv;
+	char **strv = NULL;
 	int i;
 
 	prefs->spell_active = FALSE;
 
 	/* setup the language list */
-	strv = g_strsplit (prefs->language_str, " ", 0);
 	present = g_hash_table_new (g_str_hash, g_str_equal);
-	for (i = 0; strv[i]; i++)
-		g_hash_table_insert (present, strv[i], strv[i]);
+	if (prefs->language_str && (strv = g_strsplit (prefs->language_str, " ", 0))) {
+		for (i = 0; strv[i]; i++)
+			g_hash_table_insert (present, strv[i], strv[i]);
+	}
 	
 	model = (GtkListStore *) gtk_tree_view_get_model (prefs->language);
 	for (go = gtk_tree_model_get_iter_first ((GtkTreeModel *) model, &iter); go;
@@ -513,7 +514,8 @@
 	}
 	
 	g_hash_table_destroy (present);
-	g_strfreev (strv);
+	if (strv != NULL)
+		g_strfreev (strv);
 	
 	gnome_color_picker_set_i16 (GNOME_COLOR_PICKER (prefs->colour),
 				    prefs->spell_error_color.red,


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