[Libreoffice-commits] core.git: sc/source
Caolán McNamara
caolanm at redhat.com
Wed Apr 5 08:39:35 UTC 2017
sc/source/ui/unoobj/TablePivotChart.cxx | 29 ++++++++++++++---------------
1 file changed, 14 insertions(+), 15 deletions(-)
New commits:
commit 01a4269a2e0e242e4d9b874e501c6245d014a312
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Apr 5 09:00:24 2017 +0100
coverity#1404783 Dereference null return value
Change-Id: I6bc3cc6ad5344756a65dceaf53a9f14abe9c69e3
diff --git a/sc/source/ui/unoobj/TablePivotChart.cxx b/sc/source/ui/unoobj/TablePivotChart.cxx
index 64d2d87890b1..18874f48539b 100644
--- a/sc/source/ui/unoobj/TablePivotChart.cxx
+++ b/sc/source/ui/unoobj/TablePivotChart.cxx
@@ -78,25 +78,24 @@ void SAL_CALL TablePivotChart::setName(OUString const & /* aName */)
OUString SAL_CALL TablePivotChart::getPivotTableName()
{
SolarMutexGuard aGuard;
- OUString aPivotTableName;
SdrOle2Obj* pObject = sc::tools::findChartsByName(m_pDocShell, m_nTab, m_aChartName, sc::tools::ChartSourceType::PIVOT_TABLE);
+ if (!pObject)
+ return OUString();
uno::Reference<embed::XEmbeddedObject> xObject = pObject->GetObjRef();
- if (xObject.is())
- {
- uno::Reference<chart2::XChartDocument> xChartDoc(xObject->getComponent(), uno::UNO_QUERY);
- if (xChartDoc.is())
- {
- uno::Reference<chart2::data::XPivotTableDataProvider> xPivotTableDataProvider(xChartDoc->getDataProvider(), uno::UNO_QUERY);
- if (xPivotTableDataProvider.is())
- {
- aPivotTableName = xPivotTableDataProvider->getPivotTableName();
- }
- }
- }
-
- return aPivotTableName;
+ if (!xObject.is())
+ return OUString();
+
+ uno::Reference<chart2::XChartDocument> xChartDoc(xObject->getComponent(), uno::UNO_QUERY);
+ if (!xChartDoc.is())
+ return OUString();
+
+ uno::Reference<chart2::data::XPivotTableDataProvider> xPivotTableDataProvider(xChartDoc->getDataProvider(), uno::UNO_QUERY);
+ if (!xPivotTableDataProvider.is())
+ return OUString();
+
+ return xPivotTableDataProvider->getPivotTableName();
}
} // end sc namespace
More information about the Libreoffice-commits
mailing list