summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSzymon Kłos <szymon.klos@collabora.com>2019-12-11 14:54:56 +0100
committerAron Budea <aron.budea@collabora.com>2019-12-11 18:20:26 +0100
commit85f3f8de19e63f41e9c304427e9f7a840480f21c (patch)
tree2a616fa3b843b1fb2510cb7f64b882ff674eeed1
parent7241382ccc0a028c5f08304090a6344e582db068 (diff)
Avoid crash when no uno name available
Change-Id: I81895e68d6fda46bec0cc3bca2da63901d3fed4c Reviewed-on: https://gerrit.libreoffice.org/84949 Reviewed-by: Aron Budea <aron.budea@collabora.com> Tested-by: Aron Budea <aron.budea@collabora.com>
-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 5802a9b96ad8..2232b397996d 100644
--- a/sfx2/source/view/lokhelper.cxx
+++ b/sfx2/source/view/lokhelper.cxx
@@ -220,14 +220,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();
+ }
}
}
@@ -237,7 +241,7 @@ namespace {
void SfxLokHelper::sendUnoStatus(const SfxViewShell* pShell, const SfxPoolItem* pItem)
{
- if (!pShell || !pItem || DisableCallbacks::disabled())
+ if (!pShell || !pItem || pItem == reinterpret_cast<const SfxPoolItem*>(-1) || DisableCallbacks::disabled())
return;
boost::property_tree::ptree aItem = pItem->dumpAsJSON();