diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2023-04-19 12:45:01 +0200 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2023-04-19 20:53:16 +0200 |
commit | e3de8ecc744a27fa3b8d9ad90a669bcc58d66f63 (patch) | |
tree | f6037ee7df2518af5ff96dba7a5d6261e063d312 /sfx2 | |
parent | 2c2ebb664bb5fce15c4d466e4aad73c59ce4a819 (diff) |
sfx2: fix crash in StyleList::CustomRenderHdl
GetFamilyItem() might return nullptr
See https://crashreport.libreoffice.org/stats/signature/StyleList::CustomRenderHdl(std::tuple%3COutputDevice%20&,tools::Rectangle%20const%20&,bool,rtl::OUString%20const%20&%3E)
Change-Id: I099f045232aac710c4f26148de5e798d00ecc7ec
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150602
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150636
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/dialog/StyleList.cxx | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/sfx2/source/dialog/StyleList.cxx b/sfx2/source/dialog/StyleList.cxx index 59455758e890..1fc98c3ca8ec 100644 --- a/sfx2/source/dialog/StyleList.cxx +++ b/sfx2/source/dialog/StyleList.cxx @@ -1558,17 +1558,20 @@ IMPL_LINK(StyleList, CustomRenderHdl, weld::TreeView::render_args, aPayload, voi if (pStyleManager) { - const SfxStyleFamilyItem* pItem = GetFamilyItem(); - SfxStyleSheetBase* pStyleSheet = pStyleManager->Search(rId, pItem->GetFamily()); - - if (pStyleSheet) + if (const SfxStyleFamilyItem* pItem = GetFamilyItem()) { - rRenderContext.Push(vcl::PushFlags::ALL); - sal_Int32 nSize = aRect.GetHeight(); - std::unique_ptr<sfx2::StylePreviewRenderer> pStylePreviewRenderer( - pStyleManager->CreateStylePreviewRenderer(rRenderContext, pStyleSheet, nSize)); - bSuccess = pStylePreviewRenderer->recalculate() && pStylePreviewRenderer->render(aRect); - rRenderContext.Pop(); + SfxStyleSheetBase* pStyleSheet = pStyleManager->Search(rId, pItem->GetFamily()); + + if (pStyleSheet) + { + rRenderContext.Push(vcl::PushFlags::ALL); + sal_Int32 nSize = aRect.GetHeight(); + std::unique_ptr<sfx2::StylePreviewRenderer> pStylePreviewRenderer( + pStyleManager->CreateStylePreviewRenderer(rRenderContext, pStyleSheet, nSize)); + bSuccess + = pStylePreviewRenderer->recalculate() && pStylePreviewRenderer->render(aRect); + rRenderContext.Pop(); + } } } |