LOK: Avoid crash when the command is not available in the given component.
In that case we get a NULL pSlot. Change-Id: I38783ed198b1ab9860398f59ef872a295cbae6f8
This commit is contained in:
@@ -555,7 +555,7 @@ static void doc_iniUnoCommands ()
|
|||||||
util::URL aCommandURL;
|
util::URL aCommandURL;
|
||||||
const SfxSlot* pSlot = NULL;
|
const SfxSlot* pSlot = NULL;
|
||||||
SfxViewShell* pViewShell = SfxViewShell::Current();
|
SfxViewShell* pViewShell = SfxViewShell::Current();
|
||||||
SfxViewFrame* pViewFrame = (pViewShell ? pViewShell->GetViewFrame() : NULL);
|
SfxViewFrame* pViewFrame = pViewShell? pViewShell->GetViewFrame(): NULL;
|
||||||
|
|
||||||
// check if Frame-Controller were created.
|
// check if Frame-Controller were created.
|
||||||
if (!pViewShell && !pViewFrame)
|
if (!pViewShell && !pViewFrame)
|
||||||
@@ -564,26 +564,21 @@ static void doc_iniUnoCommands ()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SfxSlotPool& rSlotPool = SfxSlotPool::GetSlotPool( pViewFrame );
|
SfxSlotPool& rSlotPool = SfxSlotPool::GetSlotPool(pViewFrame);
|
||||||
uno::Reference<util::XURLTransformer> xParser =
|
uno::Reference<util::XURLTransformer> xParser(util::URLTransformer::create(xContext));
|
||||||
util::URLTransformer::create(xContext);
|
|
||||||
|
|
||||||
for (
|
for (sal_uInt32 nIterator = 0; nIterator < SAL_N_ELEMENTS(sUnoCommands); nIterator++)
|
||||||
sal_uInt32 nIterator = 0;
|
|
||||||
nIterator < SAL_N_ELEMENTS(sUnoCommands);
|
|
||||||
nIterator++
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
aCommandURL.Complete = sUnoCommands[nIterator];
|
aCommandURL.Complete = sUnoCommands[nIterator];
|
||||||
xParser->parseStrict(aCommandURL);
|
xParser->parseStrict(aCommandURL);
|
||||||
pSlot = rSlotPool.GetUnoSlot(aCommandURL.Path);
|
pSlot = rSlotPool.GetUnoSlot(aCommandURL.Path);
|
||||||
|
|
||||||
// Initialize slot to dispatch Uno Command.
|
// when null, this command is not supported by the given component
|
||||||
uno::Reference<frame::XDispatch> xDispatch =
|
// (like eg. Calc does not have ".uno:DefaultBullet" etc.)
|
||||||
pViewFrame->GetBindings().GetDispatch( pSlot, aCommandURL, false );
|
if (pSlot)
|
||||||
if (!xDispatch.is())
|
|
||||||
{
|
{
|
||||||
SAL_WARN("lok", "iniUnoCommands: No XDispatch interface : " + aCommandURL.Complete);
|
// Initialize slot to dispatch .uno: Command.
|
||||||
|
pViewFrame->GetBindings().GetDispatch(pSlot, aCommandURL, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user