svx/source/tbxctrls/tbcontrl.cxx | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
New commits: commit f5e25d077acf6a1b8b28e0c7bfc3201d2bc1ef23 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Fri Dec 16 11:42:20 2022 +0000 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Fri Dec 16 14:51:42 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/+/144322 Tested-by: Caolán McNamara <caol...@redhat.com> Reviewed-by: Caolán McNamara <caol...@redhat.com> 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;