summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/txtnode/txtedt.cxx12
1 files changed, 10 insertions, 2 deletions
diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx
index e0c41585bf50..06e4ead70d8b 100644
--- a/sw/source/core/txtnode/txtedt.cxx
+++ b/sw/source/core/txtnode/txtedt.cxx
@@ -941,8 +941,16 @@ bool SwScanner::NextWord()
{
aBound.startPos = std::max( aBound.startPos, nStartPos );
aBound.endPos = std::min( aBound.endPos, nEndPos );
- nBegin = aBound.startPos;
- nLen = aBound.endPos - nBegin;
+ if (aBound.endPos < aBound.startPos)
+ {
+ nBegin = nEndPos;
+ nLen = 0; // found word is outside of search interval
+ }
+ else
+ {
+ nBegin = aBound.startPos;
+ nLen = aBound.endPos - nBegin;
+ }
}
if( ! nLen )