From 7885000ddf06462e26d1c29dd16d0a3ebbd60319 Mon Sep 17 00:00:00 2001 From: Crispin Flowerday Date: Fri, 23 Sep 2005 21:35:07 +0000 Subject: Don't crash if the Authors key is missing, or there are no keys in the 2005-09-23 Crispin Flowerday * src/ephy-extensions-manager.c: (ephy_extensions_manager_load_ini_string): Don't crash if the Authors key is missing, or there are no keys in the Loader section --- src/ephy-extensions-manager.c | 47 +++++++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/ephy-extensions-manager.c b/src/ephy-extensions-manager.c index e571859ff..5eaf35801 100644 --- a/src/ephy-extensions-manager.c +++ b/src/ephy-extensions-manager.c @@ -711,13 +711,17 @@ ephy_extensions_manager_load_ini_string (EphyExtensionsManager *manager, list = g_key_file_get_string_list (key_file, "Epiphany Extension", "Authors", NULL, NULL); - for (i = 0 ; list[i]; i++ ) + if (list) { - einfo->authors = g_list_prepend (einfo->authors, - g_strstrip (g_strdup (list[i]))); + for (i = 0 ; list[i]; i++ ) + { + einfo->authors = g_list_prepend (einfo->authors, + g_strstrip (g_strdup (list[i]))); + } + g_strfreev (list); } + einfo->authors = g_list_reverse (einfo->authors); - g_strfreev (list); info->version = g_key_file_get_integer (key_file, "Epiphany Extension", @@ -725,28 +729,31 @@ ephy_extensions_manager_load_ini_string (EphyExtensionsManager *manager, /* Load the loader flags */ list = g_key_file_get_keys (key_file, "Loader", NULL, NULL); - for (i = 0 ; list[i]; i++ ) + + if (list) { - - char * value; - GQuark attr_quark = 0; + for (i = 0 ; list[i]; i++ ) + { + char * value; + GQuark attr_quark = 0; - value = g_key_file_get_string (key_file, "Loader", - list[i], NULL); + value = g_key_file_get_string (key_file, "Loader", + list[i], NULL); - if (strcmp (list[i], "Type") == 0) - { - info->loader_type = value; - continue; - } + if (strcmp (list[i], "Type") == 0) + { + info->loader_type = value; + continue; + } - attr_quark = g_quark_from_string (list[i]); + attr_quark = g_quark_from_string (list[i]); - g_datalist_id_set_data_full (&info->loader_attributes, - attr_quark, value, - (GDestroyNotify) g_free); - } + g_datalist_id_set_data_full (&info->loader_attributes, + attr_quark, value, + (GDestroyNotify) g_free); + } g_strfreev (list); + } g_key_file_free (key_file); -- cgit v1.2.3