Skip to content

Commit

Permalink
dynamic_cast, contextMenuEvent, coverity issues 1075744,5, re #11151
Browse files Browse the repository at this point in the history
  • Loading branch information
FedeMPouzols committed Feb 21, 2015
1 parent 0cbecbf commit e1152f9
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions Code/Mantid/MantidPlot/src/PlotDialog.cpp
Expand Up @@ -1499,7 +1499,12 @@ void PlotDialog::contextMenuEvent(QContextMenuEvent *e)
return;
if (item->type() != CurveTreeItem::PlotCurveTreeItem)
return;
QwtPlotItem *it = dynamic_cast<QwtPlotItem *>(dynamic_cast<CurveTreeItem*>(item)->plotItem());

CurveTreeItem *ctit = dynamic_cast<CurveTreeItem*>(item);
if (!ctit)
return;

QwtPlotItem *it = dynamic_cast<QwtPlotItem *>(ctit->plotItem());
if (!it)
return;

Expand All @@ -1512,7 +1517,10 @@ void PlotDialog::contextMenuEvent(QContextMenuEvent *e)

if (it->rtti() == QwtPlotItem::Rtti_PlotCurve)
{
if (dynamic_cast<PlotCurve *>(it)->type() == Graph::Function)
PlotCurve *pc = dynamic_cast<PlotCurve *>(it);
if (!pc)
return;
if (pc->type() == Graph::Function)
contextMenu.insertItem(tr("&Edit..."), this, SLOT(editCurve()));
else
contextMenu.insertItem(tr("&Plot Associations..."), this, SLOT(editCurve()));
Expand Down

0 comments on commit e1152f9

Please sign in to comment.