diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2023-05-18 15:52:37 +0200 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2023-05-19 12:44:01 +0200 |
commit | 9f3971dedd48d0482c66e66c8c923d0dd38325dc (patch) | |
tree | b4562eda29d834622be852c154c4bb58fd322b65 /svx | |
parent | dec2b734c168a8f0c4abe08c5343fd359002dc8e (diff) |
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.stahl@allotropia.de>
Tested-by: Jenkins
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/tbxctrls/tbcontrl.cxx | 15 |
1 files changed, 10 insertions, 5 deletions
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; } |