sfx2: warning C6011: Dereferencing NULL pointer

Change-Id: Ie65284c3ded0c5789f0be5bbd770d190a92fecec
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167922
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
This commit is contained in:
Xisco Fauli
2024-05-23 09:36:33 +02:00
parent 16a56dfccb
commit 50fa7d2581
3 changed files with 14 additions and 9 deletions
+3
View File
@@ -944,6 +944,9 @@ SfxPoolItemHolder SfxBindings::Execute_Impl( sal_uInt16 nId, const SfxPoolItem**
pSlot = pServer->GetSlot();
}
if (!pShell)
return SfxPoolItemHolder();
SfxItemPool &rPool = pShell->GetPool();
SfxRequest aReq( nId, nCallMode, rPool );
aReq.SetModifier( nModi );
+9 -7
View File
@@ -707,7 +707,7 @@ bool SfxDispatcher::GetShellAndSlot_Impl(sal_uInt16 nSlot, SfxShell** ppShell,
*ppShell = GetShell(aSvr.GetShellLevel());
*ppSlot = aSvr.GetSlot();
if ( nullptr == (*ppSlot)->GetExecFnc() && bRealSlot )
if ( nullptr == (*ppSlot)->GetExecFnc() && bRealSlot && *ppShell )
*ppSlot = (*ppShell)->GetInterface()->GetRealSlot(*ppSlot);
// Check only real slots as enum slots don't have an execute function!
return !bRealSlot || ((nullptr != *ppSlot) && (nullptr != (*ppSlot)->GetExecFnc()) );
@@ -985,13 +985,15 @@ void SfxDispatcher::PostMsgHandler(std::unique_ptr<SfxRequest> pReq)
SfxSlotServer aSvr;
if ( FindServer_(pReq->GetSlot(), aSvr ) ) // HACK(x), whatever that was supposed to mean
{
const SfxSlot *pSlot = aSvr.GetSlot();
SfxShell *pSh = GetShell(aSvr.GetShellLevel());
if (SfxShell *pSh = GetShell(aSvr.GetShellLevel()))
{
const SfxSlot *pSlot = aSvr.GetSlot();
// When the pSlot is a "Pseudoslot" for macros or Verbs, it can
// be destroyed in the Call_Impl, thus do not use it anymore!
pReq->SetSynchronCall( false );
Call_Impl( *pSh, *pSlot, *pReq, pReq->AllowsRecording() ); //! why bRecord?
// When the pSlot is a "Pseudoslot" for macros or Verbs, it can
// be destroyed in the Call_Impl, thus do not use it anymore!
pReq->SetSynchronCall( false );
Call_Impl( *pSh, *pSlot, *pReq, pReq->AllowsRecording() ); //! why bRecord?
}
}
}
else
+2 -2
View File
@@ -1094,8 +1094,8 @@ void SfxViewFrame::PopShellAndSubShells_Impl( SfxViewShell& i_rViewShell )
if ( nLevel )
{
// more sub shells on the stack, which were not affected by PopSubShells_Impl
SfxShell *pSubShell = m_pDispatcher->GetShell( nLevel-1 );
m_pDispatcher->Pop( *pSubShell, SfxDispatcherPopFlags::POP_UNTIL | SfxDispatcherPopFlags::POP_DELETE );
if (SfxShell *pSubShell = m_pDispatcher->GetShell( nLevel-1 ))
m_pDispatcher->Pop( *pSubShell, SfxDispatcherPopFlags::POP_UNTIL | SfxDispatcherPopFlags::POP_DELETE );
}
m_pDispatcher->Pop( i_rViewShell );
m_pDispatcher->Flush();