svx/source/tbxctrls/tbcontrl.cxx | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
New commits: commit 63707596eefa4f141a5c7146e69bb5684ed51cf6 Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Thu May 18 15:52:37 2023 +0200 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Fri May 19 10:05:04 2023 +0200 svx: check SfxObjectShell::Current() See https://crashreport.libreoffice.org/stats/signature/static%20void%20%60anonymous%20namespace'::SvxStyleBox_Base::Select(bool) Change-Id: I6edce9c8bad1ee087ddf884ff47439cceee3f1de Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151964 Tested-by: Jenkins Tested-by: Caolán McNamara <caolan.mcnam...@collabora.com> Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx index 4feda3af8f75..ed8034028891 100644 --- a/svx/source/tbxctrls/tbcontrl.cxx +++ b/svx/source/tbxctrls/tbcontrl.cxx @@ -1011,6 +1011,9 @@ void SvxStyleBox_Base::Select(bool bNonTravelSelect) //Do we need to create a new style? SfxObjectShell *pShell = SfxObjectShell::Current(); + if (!pShell) + return; + SfxStyleSheetBasePool* pPool = pShell->GetStyleSheetPool(); SfxStyleSheetBase* pStyle = nullptr; @@ -1321,11 +1324,13 @@ static bool SetFontSize(vcl::RenderContext& rRenderContext, const SfxItemSet& rS if (GetWhich(rSet, nSlot, nWhich)) { const auto& rFontHeightItem = static_cast<const SvxFontHeightItem&>(rSet.Get(nWhich)); - SfxObjectShell *pShell = SfxObjectShell::Current(); - Size aFontSize(0, rFontHeightItem.GetHeight()); - Size aPixelSize(rRenderContext.LogicToPixel(aFontSize, MapMode(pShell->GetMapUnit()))); - rFont.SetFontSize(aPixelSize); - return true; + if (SfxObjectShell *pShell = SfxObjectShell::Current()) + { + Size aFontSize(0, rFontHeightItem.GetHeight()); + Size aPixelSize(rRenderContext.LogicToPixel(aFontSize, MapMode(pShell->GetMapUnit()))); + rFont.SetFontSize(aPixelSize); + return true; + } } return false; }