summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorSzymon Kłos <szymon.klos@collabora.com>2019-12-11 14:54:56 +0100
committerSzymon Kłos <szymon.klos@collabora.com>2019-12-11 22:51:10 +0100
commit3df4ee7e2a64824d467a5e0e6a06551b15c217ea (patch)
treecb0b8081b2225d23766501acf1b6381460981d75 /sfx2
parentdd27fedb88cc18bbfc669503cfe510d99f40f05d (diff)
Avoid crash when no uno name available
Change-Id: I81895e68d6fda46bec0cc3bca2da63901d3fed4c Reviewed-on: https://gerrit.libreoffice.org/84950 Tested-by: Jenkins Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/view/lokhelper.cxx12
1 files changed, 8 insertions, 4 deletions
diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx
index fb38b4a91e91..181d0b385cae 100644
--- a/sfx2/source/view/lokhelper.cxx
+++ b/sfx2/source/view/lokhelper.cxx
@@ -191,14 +191,18 @@ void SfxLokHelper::notifyOtherViews(SfxViewShell* pThisView, int nType, const OS
namespace {
OUString lcl_getNameForSlot(const SfxViewShell* pShell, sal_uInt16 nWhich)
{
- if (pShell->GetFrame())
+ if (pShell && pShell->GetFrame())
{
const SfxSlot* pSlot = SfxSlotPool::GetSlotPool(pShell->GetFrame()).GetSlot(nWhich);
if (pSlot)
{
OUStringBuffer sUnoCommand(".uno:");
- sUnoCommand.append(OStringToOUString(pSlot->GetUnoName(), RTL_TEXTENCODING_ASCII_US));
- return sUnoCommand.makeStringAndClear();
+ const char* pName = pSlot->GetUnoName();
+ if (pName)
+ {
+ sUnoCommand.append(OStringToOUString(pName, RTL_TEXTENCODING_ASCII_US));
+ return sUnoCommand.makeStringAndClear();
+ }
}
}
@@ -208,7 +212,7 @@ namespace {
void SfxLokHelper::sendUnoStatus(const SfxViewShell* pShell, const SfxPoolItem* pItem)
{
- if (!pShell || !pItem)
+ if (!pShell || !pItem || pItem == reinterpret_cast<const SfxPoolItem*>(-1))
return;
boost::property_tree::ptree aItem = pItem->dumpAsJSON();