From 157bf334e0f70f7bdea8c19fd310505449291677 Mon Sep 17 00:00:00 2001 From: Christian Persch Date: Mon, 21 Jun 2004 11:26:37 +0000 Subject: Check for empty attributes before adding the item when parsing the 2004-06-21 Christian Persch * lib/egg/egg-toolbars-model.c: (egg_toolbars_model_get_flags), (parse_item_list), (parse_toolbars): Check for empty attributes before adding the item when parsing the toolbars file. Should fix bug #144698. --- lib/egg/egg-toolbars-model.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'lib') diff --git a/lib/egg/egg-toolbars-model.c b/lib/egg/egg-toolbars-model.c index b6f1b8717..f10dcc25b 100755 --- a/lib/egg/egg-toolbars-model.c +++ b/lib/egg/egg-toolbars-model.c @@ -270,7 +270,7 @@ egg_toolbars_model_get_flags (EggToolbarsModel *t, EggToolbarsToolbar *toolbar; toolbar_node = g_node_nth_child (t->priv->toolbars, toolbar_position); - g_return_val_if_fail (toolbar_node != NULL, -1); + g_return_val_if_fail (toolbar_node != NULL, 0); toolbar = toolbar_node->data; @@ -364,17 +364,20 @@ parse_item_list (EggToolbarsModel *t, type = xmlGetProp (child, "type"); if (type == NULL) { - type = g_strdup (EGG_TOOLBAR_ITEM_TYPE); + type = xmlStrdup (EGG_TOOLBAR_ITEM_TYPE); } - id = egg_toolbars_model_get_item_id (t, type, name); - if (id != NULL) + if (name != NULL && name[0] != '\0' && type != NULL) { - egg_toolbars_model_add_item (t, position, -1, id, type); + id = egg_toolbars_model_get_item_id (t, type, name); + if (id != NULL) + { + egg_toolbars_model_add_item (t, position, -1, id, type); + } + g_free (id); } xmlFree (name); - g_free (type); - g_free (id); + xmlFree (type); } else if (xmlStrEqual (child->name, "separator")) { @@ -423,7 +426,7 @@ parse_toolbars (EggToolbarsModel *t, xmlFree (name); style = xmlGetProp (child, "style"); - if (style && strcmp (style, "icons-only") == 0) + if (style && xmlStrEqual (style, "icons-only")) { egg_toolbars_model_set_flags (t, EGG_TB_MODEL_ICONS_ONLY, 0); } -- cgit v1.2.3