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;
if (ins && !ins->producesOutput()) {
//skip this inset
++dit.top().pos();
+ if (dit >= to)
+ break;
continue;
}
if (par.isWordSeparator(pos))