summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--formula/source/ui/dlg/FormulaHelper.cxx4
1 files changed, 3 insertions, 1 deletions
diff --git a/formula/source/ui/dlg/FormulaHelper.cxx b/formula/source/ui/dlg/FormulaHelper.cxx
index b3c0b4a204bc..09bfe09ed67d 100644
--- a/formula/source/ui/dlg/FormulaHelper.cxx
+++ b/formula/source/ui/dlg/FormulaHelper.cxx
@@ -346,7 +346,9 @@ sal_Int32 FormulaHelper::GetFunctionEnd( const OUString& rStr, sal_Int32 nStart
nStart++; // Set behind found position
}
- return nStart;
+ // nStart > nStrLen can happen if there was an unclosed quote; instead of
+ // checking that in every loop iteration check it once here.
+ return std::min(nStart, nStrLen);
}