diff options
author | Marcos CARDINOT <mcardinot@gmail.com> | 2015-03-17 20:35:11 -0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-03-19 15:34:10 -0700 |
commit | 70b4c9f2d3c81a5a417ea34d5b43d39aeb5b951a (patch) | |
tree | bae2ede7c48bbd0db836a5eace680a633d31057a /qt-ui/profile | |
parent | d500f56d6f97d67e4991198a86726fa6c93b9a9b (diff) | |
download | subsurface-70b4c9f2d3c81a5a417ea34d5b43d39aeb5b951a.tar.gz |
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>
Diffstat (limited to 'qt-ui/profile')
-rw-r--r-- | qt-ui/profile/ruleritem.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
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<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() |