From 9d2e1f4831eef512599fe6d04801d9ee90cbe105 Mon Sep 17 00:00:00 2001 From: Harry Jeffery <henry.jeffery@stfc.ac.uk> Date: Mon, 9 Feb 2015 16:37:41 +0000 Subject: [PATCH] Refs #11014 Resolves Coverity 1076233 --- .../MantidPlot/src/ApplicationWindow.cpp | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/Code/Mantid/MantidPlot/src/ApplicationWindow.cpp b/Code/Mantid/MantidPlot/src/ApplicationWindow.cpp index 18757e47d15..ff40aae4491 100644 --- a/Code/Mantid/MantidPlot/src/ApplicationWindow.cpp +++ b/Code/Mantid/MantidPlot/src/ApplicationWindow.cpp @@ -8413,15 +8413,17 @@ void ApplicationWindow::cutSelection() if (!m) return; - if (m->inherits("Table")) - dynamic_cast<Table*>(m)->cutSelection(); - else if (m->isA("Matrix")) - dynamic_cast<Matrix*>(m)->cutSelection(); - else if(m->isA("MultiLayer")){ - MultiLayer* plot = dynamic_cast<MultiLayer*>(m); - if (!plot || plot->layers() == 0) - return; + auto t = dynamic_cast<Table*>(m); + auto mat = dynamic_cast<Matrix*>(m); + auto plot = dynamic_cast<MultiLayer*>(m); + auto note = dynamic_cast<Note*>(m); + if(t) + t->cutSelection(); + else if (mat) + mat->cutSelection(); + else if (plot && plot->layers()) + { Graph* g = dynamic_cast<Graph*>(plot->activeGraph()); if (!g) return; @@ -8434,8 +8436,8 @@ void ApplicationWindow::cutSelection() g->removeMarker(); } } - else if (m->isA("Note")) - dynamic_cast<Note*>(m)->editor()->cut(); + else if (note) + note->editor()->cut(); emit modified(); } -- GitLab