summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;
}