summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2022-05-22 12:08:44 +0100
committerCaolán McNamara <caolanm@redhat.com>2022-05-22 15:15:47 +0200
commitc4a8484bd6eb9c490b7af8c6aa1c25f05a3cfb5e (patch)
treeb790fe10d0c96d926da5fb2266a62c86385e6c94 /sc
parent8cdfc82557cf1256aaa3e1e8200d1b2ce9f16608 (diff)
cid#1504532 Dereference after null check
Change-Id: I044e3bfec2af9d6379849b8ee6ce4ecbe637cc35 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134727 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/unoobj/chartuno.cxx8
1 files changed, 5 insertions, 3 deletions
diff --git a/sc/source/ui/unoobj/chartuno.cxx b/sc/source/ui/unoobj/chartuno.cxx
index ddfee69fbd1f..a4c9777a27c1 100644
--- a/sc/source/ui/unoobj/chartuno.cxx
+++ b/sc/source/ui/unoobj/chartuno.cxx
@@ -83,9 +83,10 @@ void ScChartsObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
rtl::Reference<ScChartObj> ScChartsObj::GetObjectByIndex_Impl(tools::Long nIndex) const
{
- OUString aName;
if ( pDocShell )
{
+ OUString aName;
+
ScDocument& rDoc = pDocShell->GetDocument();
ScDrawLayer* pDrawLayer = rDoc.GetDrawLayer();
if (pDrawLayer)
@@ -114,10 +115,11 @@ rtl::Reference<ScChartObj> ScChartsObj::GetObjectByIndex_Impl(tools::Long nIndex
}
}
}
+
+ if (!aName.isEmpty())
+ return new ScChartObj( pDocShell, nTab, aName );
}
- if (!aName.isEmpty())
- return new ScChartObj( pDocShell, nTab, aName );
return nullptr;
}