diff options
-rw-r--r-- | src/Document.cxx | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/Document.cxx b/src/Document.cxx index a1d5beff6..a7dcccb0c 100644 --- a/src/Document.cxx +++ b/src/Document.cxx @@ -919,7 +919,8 @@ long Document::FindText(int minPos, int maxPos, const char *s, lenRet = pre->eopat[0] - pre->bopat[0]; if (increment == -1) { // Check for the last match on this line. - while (success && (pre->eopat[0] < endOfLine)) { + int repetitions = 1000; // Break out of infinite loop + while (success && (pre->eopat[0] < endOfLine) && (repetitions--)) { success = pre->Execute(di, pre->eopat[0], endOfLine); if (success) { if (pre->eopat[0] <= minPos) { |