diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2004-06-21 19:26:37 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2004-06-21 19:26:37 +0800 |
commit | 157bf334e0f70f7bdea8c19fd310505449291677 (patch) | |
tree | 5d3f1ad670a45ed1f7ead1c389e2ec0188e87684 /lib | |
parent | ab5f74ea9c207799a9ea36d4ddac46790e3ecfb5 (diff) | |
download | gsoc2013-epiphany-157bf334e0f70f7bdea8c19fd310505449291677.tar gsoc2013-epiphany-157bf334e0f70f7bdea8c19fd310505449291677.tar.gz gsoc2013-epiphany-157bf334e0f70f7bdea8c19fd310505449291677.tar.bz2 gsoc2013-epiphany-157bf334e0f70f7bdea8c19fd310505449291677.tar.lz gsoc2013-epiphany-157bf334e0f70f7bdea8c19fd310505449291677.tar.xz gsoc2013-epiphany-157bf334e0f70f7bdea8c19fd310505449291677.tar.zst gsoc2013-epiphany-157bf334e0f70f7bdea8c19fd310505449291677.zip |
Check for empty attributes before adding the item when parsing the
2004-06-21 Christian Persch <chpe@cvs.gnome.org>
* 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.
Diffstat (limited to 'lib')
-rwxr-xr-x | lib/egg/egg-toolbars-model.c | 19 |
1 files changed, 11 insertions, 8 deletions
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); } |