summaryrefslogtreecommitdiff
path: root/sc/source/ui/vba/vbachartobject.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source/ui/vba/vbachartobject.cxx')
-rw-r--r--sc/source/ui/vba/vbachartobject.cxx7
1 files changed, 4 insertions, 3 deletions
diff --git a/sc/source/ui/vba/vbachartobject.cxx b/sc/source/ui/vba/vbachartobject.cxx
index 617e61128e8f..8337d037e8ec 100644
--- a/sc/source/ui/vba/vbachartobject.cxx
+++ b/sc/source/ui/vba/vbachartobject.cxx
@@ -96,10 +96,11 @@ ScVbaChartObject::Delete()
uno::Reference< excel::XWorksheet > xParent( getParent(), uno::UNO_QUERY_THROW );
uno::Reference< excel::XChartObjects > xColl( xParent->ChartObjects( uno::Any() ), uno::UNO_QUERY_THROW );
ScVbaChartObjects* pChartObjectsImpl = static_cast< ScVbaChartObjects* >( xColl.get() );
- if (pChartObjectsImpl)
- pChartObjectsImpl->removeByName( getPersistName() );
- else
+ if (!pChartObjectsImpl)
throw script::BasicErrorException( OUString(), uno::Reference< uno::XInterface >(), sal_uInt32(ERRCODE_BASIC_METHOD_FAILED), "Parent is not ChartObjects" );
+
+ pChartObjectsImpl->removeByName( getPersistName() );
+
}
void