diff options
author | Caolán McNamara <caolanm@redhat.com> | 2022-12-16 12:11:38 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2022-12-16 21:17:15 +0000 |
commit | 1726c27e0d633ab04843834d2bf987bc7645807f (patch) | |
tree | 7810a18cd5bc3bf5aa345b816b372d93bd323974 /svx/source/tbxctrls | |
parent | 1ae71d8f09771ba7180be6ebdf89d36a31eb8625 (diff) |
check SfxObjectShell::Current()
SfxObjectShell::Current() can return null, it's based on the equally
vile SfxViewFrame::Current()
Change-Id: Ia5c7783680e9d8e5d3075078f16a2c15cb6f7a47
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144339
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svx/source/tbxctrls')
-rw-r--r-- | svx/source/tbxctrls/fillctrl.cxx | 27 | ||||
-rw-r--r-- | svx/source/tbxctrls/linectrl.cxx | 8 |
2 files changed, 18 insertions, 17 deletions
diff --git a/svx/source/tbxctrls/fillctrl.cxx b/svx/source/tbxctrls/fillctrl.cxx index 980c0f819e71..cfb7583be12c 100644 --- a/svx/source/tbxctrls/fillctrl.cxx +++ b/svx/source/tbxctrls/fillctrl.cxx @@ -275,11 +275,12 @@ void SvxFillToolBoxControl::StateChangedAtToolBoxControl( if(mpFillGradientItem) { const OUString aString( mpFillGradientItem->GetName() ); - const SfxObjectShell* pSh = SfxObjectShell::Current(); - mpLbFillAttr->clear(); - mpLbFillAttr->set_sensitive(true); - SvxFillAttrBox::Fill(*mpLbFillAttr, pSh->GetItem(SID_GRADIENT_LIST)->GetGradientList()); + if (const SfxObjectShell* pSh = SfxObjectShell::Current()) + { + mpLbFillAttr->set_sensitive(true); + SvxFillAttrBox::Fill(*mpLbFillAttr, pSh->GetItem(SID_GRADIENT_LIST)->GetGradientList()); + } mpLbFillAttr->set_active_text(aString); } else @@ -299,11 +300,12 @@ void SvxFillToolBoxControl::StateChangedAtToolBoxControl( if(mpHatchItem) { const OUString aString( mpHatchItem->GetName() ); - const SfxObjectShell* pSh = SfxObjectShell::Current(); - mpLbFillAttr->clear(); - mpLbFillAttr->set_sensitive(true); - SvxFillAttrBox::Fill(*mpLbFillAttr, pSh->GetItem(SID_HATCH_LIST)->GetHatchList()); + if (const SfxObjectShell* pSh = SfxObjectShell::Current()) + { + mpLbFillAttr->set_sensitive(true); + SvxFillAttrBox::Fill(*mpLbFillAttr, pSh->GetItem(SID_HATCH_LIST)->GetHatchList()); + } mpLbFillAttr->set_active_text(aString); } else @@ -323,11 +325,12 @@ void SvxFillToolBoxControl::StateChangedAtToolBoxControl( if(mpBitmapItem) { const OUString aString( mpBitmapItem->GetName() ); - const SfxObjectShell* pSh = SfxObjectShell::Current(); - mpLbFillAttr->clear(); - mpLbFillAttr->set_sensitive(true); - SvxFillAttrBox::Fill(*mpLbFillAttr, pSh->GetItem(SID_BITMAP_LIST)->GetBitmapList()); + if (const SfxObjectShell* pSh = SfxObjectShell::Current()) + { + mpLbFillAttr->set_sensitive(true); + SvxFillAttrBox::Fill(*mpLbFillAttr, pSh->GetItem(SID_BITMAP_LIST)->GetBitmapList()); + } mpLbFillAttr->set_active_text(aString); } else diff --git a/svx/source/tbxctrls/linectrl.cxx b/svx/source/tbxctrls/linectrl.cxx index b75fee2d88b0..71996d49f894 100644 --- a/svx/source/tbxctrls/linectrl.cxx +++ b/svx/source/tbxctrls/linectrl.cxx @@ -610,14 +610,12 @@ IMPL_LINK_NOARG(SvxLineBox, SelectHdl, ValueSet*, void) default: { eXLS = drawing::LineStyle_DASH; - - if ( nPos != -1 && - SfxObjectShell::Current() && - SfxObjectShell::Current()->GetItem( SID_DASH_LIST ) ) + const SfxObjectShell* pObjSh = SfxObjectShell::Current(); + if (nPos != -1 && pObjSh && pObjSh->GetItem(SID_DASH_LIST)) { // LineDashItem will only be sent if it also has a dash. // Notify cares! - SvxDashListItem const * pItem = SfxObjectShell::Current()->GetItem( SID_DASH_LIST ); + SvxDashListItem const * pItem = pObjSh->GetItem( SID_DASH_LIST ); const XDashEntry* pEntry = pItem->GetDashList()->GetDash(nPos - 2); XLineDashItem aLineDashItem(pEntry->GetName(), pEntry->GetDash()); |