]> git.lyx.org Git - lyx.git/commitdiff
Do not search for empty string
authorJuergen Spitzmueller <spitz@lyx.org>
Mon, 17 Sep 2012 07:32:47 +0000 (09:32 +0200)
committerJuergen Spitzmueller <spitz@lyx.org>
Mon, 17 Sep 2012 07:32:47 +0000 (09:32 +0200)
src/LaTeX.cpp

index ecd255f4eaec8431c4278006217812407c733f37..5623bd2c1304065d1e2e0b169911fe2e1efbf70f 100644 (file)
@@ -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;
 }