Skip to content

Commit

Permalink
check dynamic_cast, coverity issue 1075737, re #11151,
Browse files Browse the repository at this point in the history
  • Loading branch information
FedeMPouzols committed Feb 21, 2015
1 parent b4c62ec commit 37cc588
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions Code/Mantid/MantidPlot/src/PlotDialog.cpp
Expand Up @@ -3110,6 +3110,16 @@ CurveTreeItem::CurveTreeItem(QwtPlotItem *curve, LayerItem *parent, const QStrin
setIcon(0, getQPixmap("graph_disabled_xpm"));
}

Graph* CurveTreeItem::graph()
{
LayerItem *l = dynamic_cast<LayerItem *>(parent());
if (l) {
return l->graph();
} else {
return NULL;
}
}

void CurveTreeItem::setActive(bool on)
{
if (on)
Expand Down
2 changes: 1 addition & 1 deletion Code/Mantid/MantidPlot/src/PlotDialog.h
Expand Up @@ -298,7 +298,7 @@ class CurveTreeItem : public QTreeWidgetItem
enum {PlotCurveTreeItem = 1002};
CurveTreeItem(QwtPlotItem *curve, LayerItem *parent, const QString& s);

Graph* graph(){return dynamic_cast<LayerItem *>(parent())->graph();};
Graph* graph();
void setActive(bool on);

QwtPlotItem *plotItem() const{ return d_curve; };
Expand Down

0 comments on commit 37cc588

Please sign in to comment.