diff options
author | William Jon McCann <jmccann@redhat.com> | 2008-08-11 21:34:47 +0000 |
---|---|---|
committer | William Jon McCann <mccann@src.gnome.org> | 2008-08-11 21:34:47 +0000 |
commit | 0f69eb10b3a88fbd1e70123501b453ce6d3df11f (patch) | |
tree | af6b9e539568a242547ae068b4b7e2dd72399052 /capplet | |
parent | 5d0c75253ff7b0623301f9da996fb709939f7d41 (diff) | |
download | gnome-session-0f69eb10b3a88fbd1e70123501b453ce6d3df11f.tar.gz |
Try to handle null key values. May fix #546896
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
svn path=/trunk/; revision=4934
Diffstat (limited to 'capplet')
-rw-r--r-- | capplet/gsm-properties-dialog.c | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/capplet/gsm-properties-dialog.c b/capplet/gsm-properties-dialog.c index 165c7d3a..247dd2ea 100644 --- a/capplet/gsm-properties-dialog.c +++ b/capplet/gsm-properties-dialog.c @@ -401,6 +401,12 @@ key_file_set_locale_string (GKeyFile *keyfile, 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 @@ key_file_set_locale_string (GKeyFile *keyfile, } } - 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 @@ write_desktop_file (EggDesktopFile *desktop_file, 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 @@ write_desktop_file (EggDesktopFile *desktop_file, 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 @@ write_desktop_file (EggDesktopFile *desktop_file, } out: - if (error) { + if (error != NULL) { g_warning ("Error when writing desktop file %s: %s", path, error->message); |