diff options
author | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-05-01 20:28:16 +0100 |
---|---|---|
committer | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-05-02 09:24:11 +0200 |
commit | 41590e7d1f8ee67c7d5c29c89a9b246c8c8f0f05 (patch) | |
tree | 8550293a2dc028b84799b4721b8b369eba97e6d8 /basic/source | |
parent | caf719c59c6dc8db2b6a0eab8d47760277f112a3 (diff) |
WaE: C6011 Dereferencing NULL pointer warnings
Change-Id: I8edb1fefe1b2b8a3db3ee8f3a0eed59c7f08a36e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166863
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'basic/source')
-rw-r--r-- | basic/source/classes/sbxmod.cxx | 12 | ||||
-rw-r--r-- | basic/source/runtime/runtime.cxx | 2 |
2 files changed, 8 insertions, 6 deletions
diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx index 59eb93f665c4..8ca156b1238a 100644 --- a/basic/source/classes/sbxmod.cxx +++ b/basic/source/classes/sbxmod.cxx @@ -1317,12 +1317,12 @@ void SbModule::ClearPrivateVars() } } -void SbModule::implClearIfVarDependsOnDeletedBasic( SbxVariable* pVar, StarBASIC* pDeletedBasic ) +void SbModule::implClearIfVarDependsOnDeletedBasic(SbxVariable& rVar, StarBASIC* pDeletedBasic) { - if( pVar->SbxValue::GetType() != SbxOBJECT || dynamic_cast<const SbProcedureProperty*>( pVar) != nullptr ) + if (rVar.SbxValue::GetType() != SbxOBJECT || dynamic_cast<const SbProcedureProperty*>(&rVar) != nullptr) return; - SbxObject* pObj = dynamic_cast<SbxObject*>( pVar->GetObject() ); + SbxObject* pObj = dynamic_cast<SbxObject*>(rVar.GetObject()); if( pObj == nullptr ) return; @@ -1337,7 +1337,7 @@ void SbModule::implClearIfVarDependsOnDeletedBasic( SbxVariable* pVar, StarBASIC StarBASIC* pBasic = dynamic_cast<StarBASIC*>( p ); if( pBasic != nullptr && pBasic == pDeletedBasic ) { - pVar->SbxValue::Clear(); + rVar.SbxValue::Clear(); break; } } @@ -1358,13 +1358,13 @@ void SbModule::ClearVarsDependingOnDeletedBasic( StarBASIC* pDeletedBasic ) for (sal_uInt32 j = 0; j < pArray->Count(); j++) { SbxVariable* pVar = pArray->Get(j); - implClearIfVarDependsOnDeletedBasic( pVar, pDeletedBasic ); + implClearIfVarDependsOnDeletedBasic(*pVar, pDeletedBasic); } } } else { - implClearIfVarDependsOnDeletedBasic( p, pDeletedBasic ); + implClearIfVarDependsOnDeletedBasic(*p, pDeletedBasic); } } } diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx index b2f493689c0b..12d522790c38 100644 --- a/basic/source/runtime/runtime.cxx +++ b/basic/source/runtime/runtime.cxx @@ -682,6 +682,7 @@ void SbiRuntime::SetParameters( SbxArray* pParams ) } SbxVariable* v = pParams->Get(i); + assert(v); // methods are always byval! bool bByVal = dynamic_cast<const SbxMethod *>(v) != nullptr; SbxDataType t = v->GetType(); @@ -3924,6 +3925,7 @@ void SbiRuntime::SetupArgs( SbxVariable* p, sal_uInt32 nOp1 ) SbxVariable* SbiRuntime::CheckArray( SbxVariable* pElem ) { + assert(pElem); SbxArray* pPar; if( ( pElem->GetType() & SbxARRAY ) && refRedim.get() != pElem ) { |