summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSzymon Kłos <szymon.klos@collabora.com>2019-12-11 14:54:56 +0100
committerMichael Meeks <michael.meeks@collabora.com>2020-05-27 21:56:30 +0100
commit84cee9cb44a443e21400c347370a8f36c8131ee3 (patch)
tree44ed4c7f7a97e6dc533f61b524788d0aa6090698
parentb5b9b94e86f64b4f925a689763e9c758f35a0cc5 (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>
-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 704d1fa4a12d..e5cbf0173285 100644
--- a/sfx2/source/view/lokhelper.cxx
+++ b/sfx2/source/view/lokhelper.cxx
@@ -189,14 +189,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();
+ }
}
}
@@ -206,7 +210,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();