summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2022-06-22 16:05:53 +0100
committerMichael Stahl <michael.stahl@allotropia.de>2022-09-23 14:27:39 +0200
commit8647e1ce50e6397ddf5c9657b454fd67f0b05e1a (patch)
tree80d4b202f2c54cbae64fa5a1acfa7b8c58858c02
parentcrashtesting: negative index seen on loading forum-de3-15472.ods (diff)
downloadcore-8647e1ce50e6397ddf5c9657b454fd67f0b05e1a.tar.gz
core-8647e1ce50e6397ddf5c9657b454fd67f0b05e1a.zip
crashtesting: assert seen with forum-mso-de-53682
not reproducible for me, but appears to be an empty string here sometimes. Change-Id: I8465f178cc7e5a6efdc08c1d15c154eeb2277c7b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136247 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> (cherry picked from commit dff039e61ac737c779b538d20a57a5e0a401cf60)
-rw-r--r--formula/source/core/api/token.cxx8
1 files changed, 6 insertions, 2 deletions
diff --git a/formula/source/core/api/token.cxx b/formula/source/core/api/token.cxx
index a8fb0b42541d..b85fdff6dc9e 100644
--- a/formula/source/core/api/token.cxx
+++ b/formula/source/core/api/token.cxx
@@ -1176,8 +1176,12 @@ bool FormulaMissingContext::AddMissingExternal( FormulaTokenArray *pNewArr ) con
const OUString &rName = mpFunc->GetExternal();
- // initial (fast) check:
- sal_Unicode nLastChar = rName[ rName.getLength() - 1];
+ // initial (fast) checks:
+ sal_Int32 nLength = rName.getLength();
+ if (!nLength)
+ return false;
+
+ sal_Unicode nLastChar = rName[ nLength - 1];
if ( nLastChar != 't' && nLastChar != 'm' )
return false;