starmath/source/mathtype.cxx |   25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

New commits:
commit c097c2ff102e8033afd26e22b7ea092ae82e27b0
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Thu Sep 1 11:41:02 2022 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Thu Sep 1 15:01:49 2022 +0200

    cid#1509261 Dereference after null check
    
    Change-Id: Ib6dd69e4610ee6df76cde8446677e0f68bed3e0e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139157
    Tested-by: Caolán McNamara <caol...@redhat.com>
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/starmath/source/mathtype.cxx b/starmath/source/mathtype.cxx
index 518f29fc5b40..66b4dfd60f84 100644
--- a/starmath/source/mathtype.cxx
+++ b/starmath/source/mathtype.cxx
@@ -3204,19 +3204,22 @@ void MathType::HandleAttributes(SmNode *pNode,int 
nLevel)
     if (pIsText)
         HandleNodes(pIsText,nLevel+1);
 
-    switch (pTemp->GetToken().eType)
+    if (pTemp)
     {
-        case TWIDEVEC:
-        case TUNDERLINE:
-            EndTemplate(nOldPending);
-            break;
-        case TOVERLINE:
-            if ((pIsText->GetToken().eType != TTEXT) ||
-                (pIsText->GetText().getLength() > 1))
+        switch (pTemp->GetToken().eType)
+        {
+            case TWIDEVEC:
+            case TUNDERLINE:
                 EndTemplate(nOldPending);
-            break;
-        default:
-            break;
+                break;
+            case TOVERLINE:
+                if ((pIsText->GetToken().eType != TTEXT) ||
+                    (pIsText->GetText().getLength() > 1))
+                    EndTemplate(nOldPending);
+                break;
+            default:
+                break;
+        }
     }
 
     //if there was no suitable place to put the attribute,

Reply via email to