#7357 avoid an endless loop in countWords() when the "to" position is inside skipped text (e. g. note inset)

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37940 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Stephan Witt 2011-03-16 17:58:27 +00:00
parent 07ef381914
commit 0afeabb969

View File

@ -185,7 +185,7 @@ int countWords(DocIterator const & from, DocIterator const & to)
int count = 0;
bool inword = false;
for (DocIterator dit = from ; dit != to ; ) {
for (DocIterator dit = from ; dit != to && !dit.empty(); ) {
if (!dit.inTexted()) {
dit.forwardPos();
continue;
@ -202,6 +202,8 @@ int countWords(DocIterator const & from, DocIterator const & to)
if (ins && !ins->producesOutput()) {
//skip this inset
++dit.top().pos();
if (dit >= to)
break;
continue;
}
if (par.isWordSeparator(pos))