[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - sfx2/source

Szymon KÅ‚os (via logerrit) logerrit at kemper.freedesktop.org
Wed Dec 11 17:21:13 UTC 2019


 sfx2/source/view/lokhelper.cxx |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

New commits:
commit 85f3f8de19e63f41e9c304427e9f7a840480f21c
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Wed Dec 11 14:54:56 2019 +0100
Commit:     Aron Budea <aron.budea at collabora.com>
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 <aron.budea at collabora.com>
    Tested-by: Aron Budea <aron.budea at collabora.com>

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();


More information about the Libreoffice-commits mailing list