diff --git a/chart2/source/controller/main/ChartController_Insert.cxx b/chart2/source/controller/main/ChartController_Insert.cxx index dff59c8d33ee..3abb851ab976 100644 --- a/chart2/source/controller/main/ChartController_Insert.cxx +++ b/chart2/source/controller/main/ChartController_Insert.cxx @@ -216,8 +216,8 @@ void ChartController::executeDispatch_InsertLegend() ActionDescriptionProvider::INSERT, SCH_RESSTR( STR_OBJECT_LEGEND )), m_xUndoManager ); - ChartModel* pModel = dynamic_cast(getModel().get()); - Reference< chart2::XLegend > xLegend = LegendHelper::showLegend( *pModel, m_xCC ); + ChartModel& rModel = dynamic_cast(*getModel().get()); + Reference< chart2::XLegend > xLegend = LegendHelper::showLegend(rModel, m_xCC); aUndoGuard.commit(); }