summaryrefslogtreecommitdiff
path: root/svx/source/tbxctrls
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2022-12-16 11:42:20 +0000
committerCaolán McNamara <caolanm@redhat.com>2022-12-16 14:51:42 +0000
commitf5e25d077acf6a1b8b28e0c7bfc3201d2bc1ef23 (patch)
tree6b37ed945d0f56ae6bde9bc7f06ba8bdbd3c4426 /svx/source/tbxctrls
parenta4af2ba1996d2e8441ff52971f90ccdeaa44b2eb (diff)
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/+/144322 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svx/source/tbxctrls')
-rw-r--r--svx/source/tbxctrls/tbcontrl.cxx15
1 files changed, 8 insertions, 7 deletions
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index 18b6eab37c62..b1f54a303e13 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -1363,15 +1363,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;