sfx2/source/view/lokhelper.cxx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
New commits: commit 85f3f8de19e63f41e9c304427e9f7a840480f21c Author: Szymon Kłos <[email protected]> AuthorDate: Wed Dec 11 14:54:56 2019 +0100 Commit: Aron Budea <[email protected]> CommitDate: Wed Dec 11 18:20:26 2019 +0100 Avoid crash when no uno name available Change-Id: I81895e68d6fda46bec0cc3bca2da63901d3fed4c Reviewed-on: https://gerrit.libreoffice.org/84949 Reviewed-by: Aron Budea <[email protected]> Tested-by: Aron Budea <[email protected]> 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(); _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
