formula/source/core/api/token.cxx |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

New commits:
commit eacd9b08fa9914c674f287b7bdceacf94d93a6ad
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Wed Jun 22 16:05:53 2022 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Wed Jun 22 21:02:00 2022 +0200

    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/+/136287
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/formula/source/core/api/token.cxx 
b/formula/source/core/api/token.cxx
index 2ca7af78f963..9a22d9cd2205 100644
--- a/formula/source/core/api/token.cxx
+++ b/formula/source/core/api/token.cxx
@@ -1256,8 +1256,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;
 

Reply via email to