From 70b4c9f2d3c81a5a417ea34d5b43d39aeb5b951a Mon Sep 17 00:00:00 2001 From: Marcos CARDINOT Date: Tue, 17 Mar 2015 20:35:11 -0300 Subject: 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 Signed-off-by: Dirk Hohndel --- qt-ui/profile/ruleritem.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'qt-ui') diff --git a/qt-ui/profile/ruleritem.cpp b/qt-ui/profile/ruleritem.cpp index ddd8f4620..d5742ef1d 100644 --- a/qt-ui/profile/ruleritem.cpp +++ b/qt-ui/profile/ruleritem.cpp @@ -83,7 +83,11 @@ void RulerItem2::settingsChanged() ProfileWidget2 *profWidget = NULL; if (scene() && scene()->views().count()) profWidget = qobject_cast(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() -- cgit v1.2.3-70-g09d2