summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJody Goldberg <jody@gnome.org>2002-03-30 07:16:14 +0000
committerJody Goldberg <jody@src.gnome.org>2002-03-30 07:16:14 +0000
commit5f8c1ab1b277fd5297dc2c8e0c81b5f37ce45b25 (patch)
tree5c3a45ab31ec6eb17a179d47a021fabca071e576
parent6e7a6395810498531151356a1181de94dbb7e41c (diff)
downloadgnome-control-center-5f8c1ab1b277fd5297dc2c8e0c81b5f37ce45b25.tar.gz
add some protection for when there is no default.
2002-03-30 Jody Goldberg <jody@gnome.org> * mime-edit-dialog.c (populate_component_list) : add some protection for when there is no default.
-rw-r--r--capplets/file-types/ChangeLog5
-rw-r--r--capplets/file-types/mime-edit-dialog.c8
2 files changed, 11 insertions, 2 deletions
diff --git a/capplets/file-types/ChangeLog b/capplets/file-types/ChangeLog
index 11a99cbde..54bbf3273 100644
--- a/capplets/file-types/ChangeLog
+++ b/capplets/file-types/ChangeLog
@@ -1,3 +1,8 @@
+2002-03-30 Jody Goldberg <jody@gnome.org>
+
+ * mime-edit-dialog.c (populate_component_list) : add some protection
+ for when there is no default.
+
2002-03-30 Lauris Kaplinski <lauris@ximian.com>
* service-info.c: Added ghelp
diff --git a/capplets/file-types/mime-edit-dialog.c b/capplets/file-types/mime-edit-dialog.c
index d0f4f0fd0..a9a0d9695 100644
--- a/capplets/file-types/mime-edit-dialog.c
+++ b/capplets/file-types/mime-edit-dialog.c
@@ -409,7 +409,7 @@ populate_component_list (MimeEditDialog *dialog)
GtkWidget *menu_item;
GtkOptionMenu *component_select;
gchar *component_name;
- Bonobo_ServerInfo *info;
+ Bonobo_ServerInfo *info, *default_component;
int found_idx = -1, i;
menu = GTK_MENU (gtk_menu_new ());
@@ -419,10 +419,14 @@ populate_component_list (MimeEditDialog *dialog)
/* FIXME: We are leaking the whole list here, but this will be the case until I know of an easy way to duplicate
* Bonobo_ServerInfo structures */
+ default_component = dialog->p->info->default_component;
for (tmp = component_list, i = 0; tmp != NULL; tmp = tmp->next, i++) {
info = tmp->data;
- if (!strcmp (info->iid, dialog->p->info->default_component->iid))
+ g_return_if_fail (info != NULL);
+
+ if (default_component != NULL &&
+ !strcmp (info->iid, default_component->iid))
found_idx = i;
component_name = mime_type_get_pretty_name_for_server (info);