svx/source/tbxctrls/tbcontrl.cxx | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
New commits: commit 9f3971dedd48d0482c66e66c8c923d0dd38325dc Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Thu May 18 15:52:37 2023 +0200 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Fri May 19 12:44:01 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/+/151923 Reviewed-by: Michael Stahl <michael.st...@allotropia.de> Tested-by: Jenkins diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx index 034a46645ff4..281fc6754ac3 100644 --- a/svx/source/tbxctrls/tbcontrl.cxx +++ b/svx/source/tbxctrls/tbcontrl.cxx @@ -1006,6 +1006,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; @@ -1316,11 +1319,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; }