* src/lyxfind.C: fix change tracking crash

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17011 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Michael Schmitt 2007-02-01 17:26:29 +00:00
parent cdd8c9e076
commit 1761baaf24

View File

@ -348,12 +348,21 @@ bool findNextChange(BufferView * bv)
Change orig_change = cur.paragraph().lookupChange(cur.pos());
DocIterator et = doc_iterator_end(cur.inset());
DocIterator ok = cur; // see below
for (; cur != et; cur.forwardPosNoDescend()) {
ok = cur;
Change change = cur.paragraph().lookupChange(cur.pos());
if (change != orig_change) {
break;
}
}
// avoid crash (assertion violation) if the imaginary end-of-par
// character of the last paragraph of the document is marked as changed
if (cur == et) {
cur = ok;
}
// Now put cursor to end of selection:
bv->cursor().setCursor(cur);
bv->cursor().setSelection();