summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2017-12-21 23:42:19 +0100
committerMichael Stahl <mstahl@redhat.com>2018-01-03 17:24:19 +0100
commitde5d9ffd8879d5a09724fc727a86aae64e3aadc2 (patch)
treea0205a5db076304dbe000a8283124f73a4eb6ac6 /chart2
parent612a613a6bad3574f4750b27a3638064963baf14 (diff)
prevent crash when trying to edit broken chart documents
Change-Id: Ie5fb706011ca600b42e5e2d3770e919b56347edd Reviewed-on: https://gerrit.libreoffice.org/46938 Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com> Tested-by: Jenkins <ci@libreoffice.org> (cherry picked from commit 1d2eb0b64339a771152bb17831c83373830e5c38) Reviewed-on: https://gerrit.libreoffice.org/47004 Reviewed-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'chart2')
-rw-r--r--chart2/source/controller/sidebar/ChartElementsPanel.cxx6
1 files changed, 6 insertions, 0 deletions
diff --git a/chart2/source/controller/sidebar/ChartElementsPanel.cxx b/chart2/source/controller/sidebar/ChartElementsPanel.cxx
index 7f2a471ce0f7..2f9d7ebaec27 100644
--- a/chart2/source/controller/sidebar/ChartElementsPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartElementsPanel.cxx
@@ -397,10 +397,16 @@ css::uno::Reference<css::chart2::XChartType> getChartType(const css::uno::Refere
css::uno::Sequence<css::uno::Reference<css::chart2::XCoordinateSystem>> xCooSysSequence(xCooSysContainer->getCoordinateSystems());
+ if (xCooSysSequence.getLength() == 0)
+ return css::uno::Reference<css::chart2::XChartType>();
+
css::uno::Reference<css::chart2::XChartTypeContainer> xChartTypeContainer(xCooSysSequence[0], css::uno::UNO_QUERY_THROW);
css::uno::Sequence<css::uno::Reference<css::chart2::XChartType>> xChartTypeSequence(xChartTypeContainer->getChartTypes());
+ if (xChartTypeSequence.getLength() == 0)
+ return css::uno::Reference<css::chart2::XChartType>();
+
return xChartTypeSequence[0];
}