summaryrefslogtreecommitdiff
path: root/sfx2/source/appl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2013-08-30 16:06:44 +0100
committerCaolán McNamara <caolanm@redhat.com>2013-08-30 16:07:20 +0100
commitdd0f6c737b6af659389e473296e939ec6cfa5f4e (patch)
tree3454f88a3adc08cfa9dcc1888739bd149a7cba2f /sfx2/source/appl
parent0f3895a78ecf1f9730f41a41f3c2f2fecd0d8b83 (diff)
Resolves: fdo#66700 don't crash on querying zoom state with no SfxObjectShell
Change-Id: Id2943c92ce6deaae3e4d507a35c08466db21cece
Diffstat (limited to 'sfx2/source/appl')
-rw-r--r--sfx2/source/appl/appserv.cxx11
1 files changed, 9 insertions, 2 deletions
diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx
index d84fb829ed59..e4c77c185f8e 100644
--- a/sfx2/source/appl/appserv.cxx
+++ b/sfx2/source/appl/appserv.cxx
@@ -602,6 +602,10 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq )
case SID_ZOOM_ENTIRE_PAGE:
case SID_ZOOM_PAGE_WIDTH:
{
+ SfxObjectShell* pCurrentShell = SfxObjectShell::Current();
+ if (!pCurrentShell)
+ return;
+
// make sure aZoom is initialized with a proper value if SetType
// doesn't work
SvxZoomItem aZoom( SVX_ZOOM_PERCENT, 100 );
@@ -634,7 +638,7 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq )
break;
}
- SfxViewFrame::Current()->GetDispatcher()->Execute(SID_ATTR_ZOOM, SFX_CALLMODE_ASYNCHRON, &aZoom, 0L);
+ pCurrentShell->GetDispatcher()->Execute(SID_ATTR_ZOOM, SFX_CALLMODE_ASYNCHRON, &aZoom, 0L);
break;
}
@@ -818,8 +822,11 @@ void SfxApplication::MiscState_Impl(SfxItemSet &rSet)
case SID_ZOOM_ENTIRE_PAGE:
case SID_ZOOM_PAGE_WIDTH:
{
+ SfxObjectShell* pCurrentShell = SfxObjectShell::Current();
+
const SfxPoolItem *pItem;
- SfxItemState aState = SfxViewFrame::Current()->GetDispatcher()->QueryState(SID_ATTR_ZOOM, pItem);
+ SfxItemState aState = pCurrentShell ?
+ pCurrentShell->GetDispatcher()->QueryState(SID_ATTR_ZOOM, pItem) : SFX_ITEM_DISABLED;
if ( aState == SFX_ITEM_DISABLED )
rSet.DisableItem( nWhich );
}