From ec078bd29d81cc22a23bfeeb08a288099c0ef70c Mon Sep 17 00:00:00 2001 From: Juergen Spitzmueller Date: Mon, 17 Sep 2012 09:32:47 +0200 Subject: [PATCH] Do not search for empty string --- src/LaTeX.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/LaTeX.cpp b/src/LaTeX.cpp index ecd255f4ea..5623bd2c13 100644 --- a/src/LaTeX.cpp +++ b/src/LaTeX.cpp @@ -1044,7 +1044,7 @@ int iterateLine(string const token, regex const reg, string const closing, // result = -1 means we did not find a fragment! int result = -1; int last_match_pos = -1; - if (token.find(last_match) != string::npos) + if (!last_match.empty() && token.find(last_match) != string::npos) last_match_pos = int(token.find(last_match)); if (fragment) { if (last_match_pos > fragment_pos) @@ -1054,6 +1054,7 @@ int iterateLine(string const token, regex const reg, string const closing, } else if (last_match_pos < fragment_pos) result = fragment_pos; + return result; } -- 2.39.5