summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2022-02-13 16:57:47 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-02-13 19:48:14 +0100
commit11a3e5707d6b524728b24e170eb542bba273d811 (patch)
tree40ae2b2b183dc0a378bee04563e813de4afe08b9 /chart2
parent5854e65351a7ff430b01ec9eb7db75fa659c3ee1 (diff)
tdf#147394 delete crash legend
regression from commit 63e8c2ccd39263b24f644c3d0394044a2613eb88 Author: Noel Grandin <noelgrandin@gmail.com> Date: Sat Jan 29 21:21:27 2022 +0200 use more concrete types in chart2, Diagram Change-Id: I6598bb7c116bd94272a805e77751aa8cf5dc174a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129882 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'chart2')
-rw-r--r--chart2/source/controller/main/ChartController_Tools.cxx18
1 files changed, 11 insertions, 7 deletions
diff --git a/chart2/source/controller/main/ChartController_Tools.cxx b/chart2/source/controller/main/ChartController_Tools.cxx
index ccf18ae37d15..92035d9d1bbd 100644
--- a/chart2/source/controller/main/ChartController_Tools.cxx
+++ b/chart2/source/controller/main/ChartController_Tools.cxx
@@ -616,13 +616,17 @@ bool ChartController::executeDispatch_Delete()
rtl::Reference< Diagram > xDiagram( xChartDoc->getFirstChartDiagram());
if( xDiagram.is())
{
- UndoGuard aUndoGuard(
- ActionDescriptionProvider::createDescription(
- ActionDescriptionProvider::ActionType::Delete, SchResId( STR_OBJECT_LEGEND )),
- m_xUndoManager );
- xDiagram->setPropertyValue( "Show", uno::Any( false ));
- bReturn = true;
- aUndoGuard.commit();
+ uno::Reference< beans::XPropertySet > xLegendProp( xDiagram->getLegend(), uno::UNO_QUERY );
+ if( xLegendProp.is())
+ {
+ UndoGuard aUndoGuard(
+ ActionDescriptionProvider::createDescription(
+ ActionDescriptionProvider::ActionType::Delete, SchResId( STR_OBJECT_LEGEND )),
+ m_xUndoManager );
+ xLegendProp->setPropertyValue( "Show", uno::Any( false ));
+ bReturn = true;
+ aUndoGuard.commit();
+ }
}
break;
}