svx/source/tbxctrls/tbcontrl.cxx |   15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

New commits:
commit 18264aa0a97e7854c98527c0a0fcc8383e9aaf0e
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Fri Dec 16 11:42:20 2022 +0000
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Sat Dec 17 19:25:06 2022 +0000

    likely fix for frequent pShell->GetStyleSheetPool crash
    
    SfxObjectShell: :Current can return null, it's based on the equally vile
    SfxViewFrame: :Current
    Change-Id: I1d937b92188deb06eef36af5d0835e173d588d2b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144305
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index 89bbf9c738a9..ff1d519e5b2e 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -1159,15 +1159,16 @@ void SvxStyleBox_Base::SetupEntry(vcl::RenderContext& 
rRenderContext, sal_Int32
         return;
 
     SfxObjectShell *pShell = SfxObjectShell::Current();
+    if (!pShell)
+        return;
+
     SfxStyleSheetBasePool* pPool = pShell->GetStyleSheetPool();
-    SfxStyleSheetBase* pStyle = nullptr;
+    if (!pPool)
+        return;
 
-    if ( pPool )
-    {
-        pStyle = pPool->First(eStyleFamily);
-        while (pStyle && pStyle->GetName() != rStyleName)
-            pStyle = pPool->Next();
-    }
+    SfxStyleSheetBase* pStyle = pPool->First(eStyleFamily);
+    while (pStyle && pStyle->GetName() != rStyleName)
+        pStyle = pPool->Next();
 
     if (!pStyle )
         return;

Reply via email to