summaryrefslogtreecommitdiff
path: root/pango/pango-attributes.c
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2004-02-05 22:44:12 +0000
committerOwen Taylor <otaylor@src.gnome.org>2004-02-05 22:44:12 +0000
commit19a87cc237b77b86dda507b72ca4be09666ea235 (patch)
tree3637ad13d9def58883f346b370ffd39052faf120 /pango/pango-attributes.c
parent3517707a6c8b8e31c57ce45722a9ff6a937702f0 (diff)
downloadpango-19a87cc237b77b86dda507b72ca4be09666ea235.tar.gz
Fix problem with empty markup tags (#128102, Christian Persch)
Thu Feb 5 16:30:46 2004 Owen Taylor <otaylor@redhat.com> Fix problem with empty markup tags (#128102, Christian Persch) * pango/pango-context.c (itemize_state_process_run): Assert that the run is non-empty. * pango/pango-attributes.c (pango_attr_list_change): Just ignore empty attributes. * pango/pango-attributes.c (pango_attr_iterator_next): Skip empty attributes.
Diffstat (limited to 'pango/pango-attributes.c')
-rw-r--r--pango/pango-attributes.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/pango/pango-attributes.c b/pango/pango-attributes.c
index 6dd070d7..2fb187c9 100644
--- a/pango/pango-attributes.c
+++ b/pango/pango-attributes.c
@@ -941,8 +941,11 @@ pango_attr_list_change (PangoAttrList *list,
GSList *tmp_list, *prev, *link;
gint start_index = attr->start_index;
gint end_index = attr->end_index;
-
+
g_return_if_fail (list != NULL);
+
+ if (start_index == end_index) /* empty, nothing to do */
+ return;
tmp_list = list->attributes;
prev = NULL;
@@ -1274,9 +1277,12 @@ pango_attr_iterator_next (PangoAttrIterator *iterator)
while (iterator->next_attribute &&
((PangoAttribute *)iterator->next_attribute->data)->start_index == iterator->start_index)
{
- iterator->attribute_stack = g_list_prepend (iterator->attribute_stack, iterator->next_attribute->data);
- iterator->end_index = MIN (iterator->end_index, ((PangoAttribute *)iterator->next_attribute->data)->end_index);
- iterator->next_attribute = iterator->next_attribute->next;
+ if (((PangoAttribute *)iterator->next_attribute->data)->end_index > iterator->start_index)
+ {
+ iterator->attribute_stack = g_list_prepend (iterator->attribute_stack, iterator->next_attribute->data);
+ iterator->end_index = MIN (iterator->end_index, ((PangoAttribute *)iterator->next_attribute->data)->end_index);
+ iterator->next_attribute = iterator->next_attribute->next;
+ }
}
if (iterator->next_attribute)