compilerplugins/clang/redundantcast.cxx |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 3ad3ff5b28988ddbd223b58467c0b5946fbff91d
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Mon Aug 5 08:13:14 2024 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Mon Aug 5 14:36:49 2024 +0200

    loplugin:redundantcast fix crash
    
    found while working on a patch
    
    Change-Id: Ic8a960c033d1841fc7c4af89b10f4b672996cb7f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171473
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/compilerplugins/clang/redundantcast.cxx 
b/compilerplugins/clang/redundantcast.cxx
index 6bace5282275..5d34d6b02936 100644
--- a/compilerplugins/clang/redundantcast.cxx
+++ b/compilerplugins/clang/redundantcast.cxx
@@ -897,7 +897,7 @@ bool 
RedundantCast::VisitCXXDynamicCastExpr(CXXDynamicCastExpr const * expr) {
                 << t2 << t1 << expr->getSourceRange();
             return true;
         }
-        if (qt1->getAsCXXRecordDecl() && 
qt2->getAsCXXRecordDecl()->isDerivedFrom(qt1->getAsCXXRecordDecl()))
+        if (qt1->getAsCXXRecordDecl() && qt2->getAsCXXRecordDecl() && 
qt2->getAsCXXRecordDecl()->isDerivedFrom(qt1->getAsCXXRecordDecl()))
         {
             report(
                 DiagnosticsEngine::Warning,

Reply via email to