From: handa Date: Fri, 2 Sep 2005 06:01:57 +0000 (+0000) Subject: (mtext__adjust_plist_for_change): Pay attention for X-Git-Tag: REL-1-3-0~211 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=9a75163911116292e7e1b8811a8f41c1d200286a;p=m17n%2Fm17n-lib.git (mtext__adjust_plist_for_change): Pay attention for the case that head is NULL. --- 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;