gnome-session r4934 - in trunk: . capplet



Author: mccann
Date: Mon Aug 11 21:34:47 2008
New Revision: 4934
URL: http://svn.gnome.org/viewvc/gnome-session?rev=4934&view=rev

Log:
2008-08-11  William Jon McCann  <jmccann redhat com>

	* capplet/gsm-properties-dialog.c (key_file_set_locale_string),
	(write_desktop_file):
	Try to handle null key values.
	May fix #546896



Modified:
   trunk/ChangeLog
   trunk/capplet/gsm-properties-dialog.c

Modified: trunk/capplet/gsm-properties-dialog.c
==============================================================================
--- trunk/capplet/gsm-properties-dialog.c	(original)
+++ trunk/capplet/gsm-properties-dialog.c	Mon Aug 11 21:34:47 2008
@@ -401,6 +401,12 @@
         const char * const *langs_pointer;
         int                 i;
 
+        g_assert (key != NULL);
+
+        if (value == NULL) {
+                value = "";
+        }
+
         locale = NULL;
         langs_pointer = g_get_language_names ();
 
@@ -412,9 +418,12 @@
                 }
         }
 
-        if (locale) {
-                g_key_file_set_locale_string (keyfile, group,
-                                              key, locale, value);
+        if (locale != NULL) {
+                g_key_file_set_locale_string (keyfile,
+                                              group,
+                                              key,
+                                              locale,
+                                              value);
         } else {
                 g_key_file_set_string (keyfile, "Desktop Entry", key, value);
         }
@@ -494,12 +503,11 @@
         path = g_file_get_path (source);
 
         error = NULL;
-
-        g_key_file_load_from_file (keyfile, path,
-                                   G_KEY_FILE_KEEP_COMMENTS|G_KEY_FILE_KEEP_TRANSLATIONS,
+        g_key_file_load_from_file (keyfile,
+                                   path,
+                                   G_KEY_FILE_KEEP_COMMENTS | G_KEY_FILE_KEEP_TRANSLATIONS,
                                    &error);
-
-        if (error) {
+        if (error != NULL) {
                 goto out;
         }
 
@@ -519,7 +527,8 @@
                 path_changed = TRUE;
         }
 
-        gtk_tree_model_get (GTK_TREE_MODEL (store), iter,
+        gtk_tree_model_get (GTK_TREE_MODEL (store),
+                            iter,
                             STORE_COL_NAME, &name,
                             STORE_COL_COMMAND, &command,
                             STORE_COL_COMMENT, &comment,
@@ -556,7 +565,7 @@
         }
 
  out:
-        if (error) {
+        if (error != NULL) {
                 g_warning ("Error when writing desktop file %s: %s",
                            path, error->message);
 



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