summaryrefslogtreecommitdiff
path: root/svx/source/tbxctrls
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2022-12-16 12:11:38 +0000
committerCaolán McNamara <caolanm@redhat.com>2022-12-16 21:17:15 +0000
commit1726c27e0d633ab04843834d2bf987bc7645807f (patch)
tree7810a18cd5bc3bf5aa345b816b372d93bd323974 /svx/source/tbxctrls
parent1ae71d8f09771ba7180be6ebdf89d36a31eb8625 (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.cxx27
-rw-r--r--svx/source/tbxctrls/linectrl.cxx8
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());