summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sc/source/ui/view/tabvwshb.cxx6
-rw-r--r--sfx2/source/control/ctrlitem.cxx16
-rw-r--r--sfx2/source/control/dispatch.cxx21
-rw-r--r--sfx2/source/control/unoctitm.cxx4
-rw-r--r--sfx2/source/view/viewfrm.cxx3
5 files changed, 34 insertions, 16 deletions
diff --git a/sc/source/ui/view/tabvwshb.cxx b/sc/source/ui/view/tabvwshb.cxx
index d718a2e2cd00..6d7d89421d09 100644
--- a/sc/source/ui/view/tabvwshb.cxx
+++ b/sc/source/ui/view/tabvwshb.cxx
@@ -712,6 +712,9 @@ bool ScTabViewShell::IsSignatureLineSigned()
void ScTabViewShell::ExecuteUndo(SfxRequest& rReq)
{
SfxShell* pSh = GetViewData().GetDispatcher().GetShell(0);
+ if (!pSh)
+ return;
+
ScUndoManager* pUndoManager = static_cast<ScUndoManager*>(pSh->GetUndoManager());
const SfxItemSet* pReqArgs = rReq.GetArgs();
@@ -812,6 +815,9 @@ void ScTabViewShell::ExecuteUndo(SfxRequest& rReq)
void ScTabViewShell::GetUndoState(SfxItemSet &rSet)
{
SfxShell* pSh = GetViewData().GetDispatcher().GetShell(0);
+ if (!pSh)
+ return;
+
SfxUndoManager* pUndoManager = pSh->GetUndoManager();
ScUndoManager* pScUndoManager = dynamic_cast<ScUndoManager*>(pUndoManager);
diff --git a/sfx2/source/control/ctrlitem.cxx b/sfx2/source/control/ctrlitem.cxx
index 28edfec666de..df7ba128659d 100644
--- a/sfx2/source/control/ctrlitem.cxx
+++ b/sfx2/source/control/ctrlitem.cxx
@@ -325,15 +325,17 @@ MapUnit SfxControllerItem::GetCoreMetric() const
const SfxSlotServer *pServer = pCache->GetSlotServer( *pDispat );
if ( pServer )
{
- SfxShell *pSh = pDispat->GetShell( pServer->GetShellLevel() );
- SfxItemPool &rPool = pSh->GetPool();
- sal_uInt16 nWhich = rPool.GetWhich( nId );
+ if (SfxShell *pSh = pDispat->GetShell( pServer->GetShellLevel() ))
+ {
+ SfxItemPool &rPool = pSh->GetPool();
+ sal_uInt16 nWhich = rPool.GetWhich( nId );
- // invalidate slot and its message|slot server as 'global' information
- // about the validated message|slot server is not made available
- pCache->Invalidate( true );
+ // invalidate slot and its message|slot server as 'global' information
+ // about the validated message|slot server is not made available
+ pCache->Invalidate( true );
- return rPool.GetMetric( nWhich );
+ return rPool.GetMetric( nWhich );
+ }
}
}
diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx
index 17edf97cc16d..9d85075de433 100644
--- a/sfx2/source/control/dispatch.cxx
+++ b/sfx2/source/control/dispatch.cxx
@@ -774,11 +774,13 @@ const SfxSlot* SfxDispatcher::GetSlot( const OUString& rCommand )
for ( sal_uInt16 i = 0; i < nTotCount; ++i )
{
- SfxShell *pObjShell = GetShell(i);
- SfxInterface *pIFace = pObjShell->GetInterface();
- const SfxSlot *pSlot = pIFace->GetSlot( rCommand );
- if ( pSlot )
- return pSlot;
+ if (SfxShell *pObjShell = GetShell(i))
+ {
+ SfxInterface *pIFace = pObjShell->GetInterface();
+ const SfxSlot *pSlot = pIFace->GetSlot( rCommand );
+ if ( pSlot )
+ return pSlot;
+ }
}
return nullptr;
@@ -1152,6 +1154,9 @@ void SfxDispatcher::Update_Impl_( bool bUIActive, bool bIsMDIApp, bool bIsIPOwne
for ( sal_uInt16 nShell = nTotCount; nShell > 0; --nShell )
{
SfxShell *pShell = GetShell( nShell-1 );
+ if (!pShell)
+ continue;
+
SfxInterface *pIFace = pShell->GetInterface();
// don't consider shells if "Hidden" or "Quiet"
@@ -1567,6 +1572,9 @@ bool SfxDispatcher::FindServer_(sal_uInt16 nSlot, SfxSlotServer& rServer)
for ( sal_uInt16 i = nFirstShell; i < nTotCount; ++i )
{
SfxShell *pObjShell = GetShell(i);
+ if (!pObjShell)
+ continue;
+
SfxInterface *pIFace = pObjShell->GetInterface();
const SfxSlot *pSlot = pIFace->GetSlot(nSlot);
@@ -1646,7 +1654,8 @@ bool SfxDispatcher::FillState_(const SfxSlotServer& rSvr, SfxItemSet& rState,
// Determine the object and call the Message of this object
SfxShell *pSh = GetShell(rSvr.GetShellLevel());
- DBG_ASSERT(pSh, "ObjectShell not found");
+ if (!pSh)
+ return false;
SfxStateFunc pFunc;
diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx
index 6f68292f46b4..45588bf1ccb9 100644
--- a/sfx2/source/control/unoctitm.cxx
+++ b/sfx2/source/control/unoctitm.cxx
@@ -860,9 +860,7 @@ void SfxDispatchController_Impl::StateChanged( sal_uInt16 nSID, SfxItemState eSt
// TODO/LATER: what about the FormShell? Does it use any metric data?! Perhaps it should use the Pool of the document!
if ( pSlotServ && pDispatcher )
{
- SfxShell* pShell = pDispatcher->GetShell( pSlotServ->GetShellLevel() );
- DBG_ASSERT( pShell, "Can't get core metric without shell!" );
- if ( pShell )
+ if (SfxShell* pShell = pDispatcher->GetShell( pSlotServ->GetShellLevel() ))
eMapUnit = GetCoreMetric( pShell->GetPool(), nSID );
}
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index 68ea4a3f8933..f20d4932494a 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -954,6 +954,9 @@ void SfxViewFrame::ExecHistory_Impl( SfxRequest &rReq )
{
// Is there an Undo-Manager on the top Shell?
SfxShell *pSh = GetDispatcher()->GetShell(0);
+ if (!pSh)
+ return;
+
SfxUndoManager* pShUndoMgr = pSh->GetUndoManager();
bool bOK = false;
if ( pShUndoMgr )