svx/source/tbxctrls/tbcontrl.cxx | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
New commits: commit 41afea6e3228ecd51a178bf703be3f9ebfaa9f76 Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Thu May 18 15:52:37 2023 +0200 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Tue May 30 21:40:51 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 (cherry picked from commit ddc838a14108a175289a0261d8daebf53cc440e1) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151927 Reviewed-by: Eike Rathke <er...@redhat.com> Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakan...@libreoffice.org> Reviewed-by: Hossein <hoss...@libreoffice.org> Tested-by: Xisco Fauli <xiscofa...@libreoffice.org> Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> 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; }