From e4e80ed313882f9ea1b309054e5aa3e839586516 Mon Sep 17 00:00:00 2001 From: Noel Date: Sat, 6 Mar 2021 20:40:58 +0200 Subject: loplugin:staticdynamic now with extra salt because it wasn't quite there yet - now checks for casts with and without const, because const doesn't really matter here. Change-Id: I319025b2095a803fcaad2a7a696d2730b7fd2f81 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112098 Tested-by: Jenkins Reviewed-by: Noel Grandin --- sc/source/core/tool/interpr4.cxx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'sc/source/core/tool/interpr4.cxx') diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx index e71f5ebfe2fa..08c1c218748d 100644 --- a/sc/source/core/tool/interpr4.cxx +++ b/sc/source/core/tool/interpr4.cxx @@ -3225,14 +3225,19 @@ void ScInterpreter::ScMacro() } SbxVariable* pVar = pRoot ? pRoot->Find(aMacro, SbxClassType::Method) : nullptr; - if( !pVar || pVar->GetType() == SbxVOID || dynamic_cast( pVar) == nullptr ) + if( !pVar || pVar->GetType() == SbxVOID ) + { + PushError( FormulaError::NoMacro ); + return; + } + SbMethod* pMethod = dynamic_cast(pVar); + if( !pMethod ) { PushError( FormulaError::NoMacro ); return; } bool bVolatileMacro = false; - SbMethod* pMethod = static_cast(pVar); SbModule* pModule = pMethod->GetModule(); bool bUseVBAObjects = pModule->IsVBACompat(); -- cgit v1.2.3