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.
This commit is contained in:
Jody Goldberg 2002-03-30 07:16:14 +00:00 committed by Jody Goldberg
parent 6e7a639581
commit 5f8c1ab1b2
2 changed files with 11 additions and 2 deletions

View file

@ -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

View file

@ -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);