From 9a75163911116292e7e1b8811a8f41c1d200286a Mon Sep 17 00:00:00 2001 From: handa Date: Fri, 2 Sep 2005 06:01:57 +0000 Subject: [PATCH] (mtext__adjust_plist_for_change): Pay attention for the case that head is NULL. --- src/textprop.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/textprop.c b/src/textprop.c index 3d84043..e2abb67 100644 --- a/src/textprop.c +++ b/src/textprop.c @@ -1448,19 +1448,22 @@ mtext__adjust_plist_for_change (MText *mt, int pos, int len1, int len2) MTextProperty *prop; int i; - if (head->start == pos2) - head = head->prev; - while (tail != head) + if (head) { - for (i = 0; i < tail->nprops; i++) + if (head->start == pos2) + head = head->prev; + while (tail != head) { - prop = tail->stack[i]; - if (prop->start == tail->start) - prop->start += diff, prop->end += diff; + for (i = 0; i < tail->nprops; i++) + { + prop = tail->stack[i]; + if (prop->start == tail->start) + prop->start += diff, prop->end += diff; + } + tail->start += diff; + tail->end += diff; + tail = tail->prev; } - tail->start += diff; - tail->end += diff; - tail = tail->prev; } for (i = 0; i < tail->nprops; i++) tail->stack[i]->end += diff; -- 1.7.10.4