starmath/source/mathtype.cxx | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
New commits: commit 3554e6d92b9045e6dd9881e294c3306dc08aeac9 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Sat Sep 3 11:00:09 2022 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Sat Sep 3 14:52:46 2022 +0200 cid#1509261 Dereference after null check Change-Id: I74cf3eed734bc09abdbca455d9a762b5aeb02481 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139315 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/starmath/source/mathtype.cxx b/starmath/source/mathtype.cxx index 66b4dfd60f84..9273a4498b61 100644 --- a/starmath/source/mathtype.cxx +++ b/starmath/source/mathtype.cxx @@ -3191,8 +3191,9 @@ void MathType::HandleAttributes(SmNode *pNode,int nLevel) break; case TOVERLINE: //If the next node is not text //or text with more than one char - if ((pIsText->GetToken().eType != TTEXT) || - (pIsText->GetText().getLength() > 1)) + if (!pIsText || + pIsText->GetToken().eType != TTEXT || + pIsText->GetText().getLength() > 1) nOldPending = StartTemplate(0x11); break; default: @@ -3213,8 +3214,9 @@ void MathType::HandleAttributes(SmNode *pNode,int nLevel) EndTemplate(nOldPending); break; case TOVERLINE: - if ((pIsText->GetToken().eType != TTEXT) || - (pIsText->GetText().getLength() > 1)) + if (!pIsText || + pIsText->GetToken().eType != TTEXT || + pIsText->GetText().getLength() > 1) EndTemplate(nOldPending); break; default: @@ -3261,8 +3263,9 @@ void MathType::HandleAttributes(SmNode *pNode,int nLevel) pS->WriteUChar( 16 ); break; case TOVERLINE: - if ((pIsText->GetToken().eType == TTEXT) && - (pIsText->GetText().getLength() == 1)) + if (pIsText && + (pIsText->GetToken().eType == TTEXT && + pIsText->GetText().getLength() == 1)) pS->WriteUChar( 17 ); break; case TBREVE: