RulerItem2::settingsChanged() - NULL pointer dereference

The current code is dereferencing the null pointer 'profWidget'.
It can cause a segmentation fault.

Signed-off-by: Marcos Cardinot <mcardinot@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Marcos CARDINOT 2015-03-17 20:35:11 -03:00 committed by Dirk Hohndel
parent d500f56d6f
commit 70b4c9f2d3

View file

@ -83,7 +83,11 @@ void RulerItem2::settingsChanged()
ProfileWidget2 *profWidget = NULL;
if (scene() && scene()->views().count())
profWidget = qobject_cast<ProfileWidget2 *>(scene()->views().first());
setVisible(profWidget->currentState == ProfileWidget2::PROFILE ? prefs.rulergraph : false);
if (profWidget && profWidget->currentState == ProfileWidget2::PROFILE)
setVisible(prefs.rulergraph);
else
setVisible(false);
}
void RulerItem2::recalculate()