summaryrefslogtreecommitdiffstats
path: root/profile-widget
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2018-05-02 13:21:00 +0200
committerGravatar Lubomir I. Ivanov <neolit123@gmail.com>2018-05-03 02:14:03 +0300
commitfb84b1185428dd8557bba915c6a018657b92ad2f (patch)
treeb7ddfd7f323c94ee130a7d50dda7c5be48a2de9f /profile-widget
parent12e4b6d62c06cde3e8ad0d1202ebd52b020f693c (diff)
downloadsubsurface-fb84b1185428dd8557bba915c6a018657b92ad2f.tar.gz
Profile: Fix crash on addition of dive to fresh logbook
If there is no current dive, the macro current_dc returns NULL. This led to a null-pointer dereference. Reported-by: Martin Měřinský <mermar@centrum.cz> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'profile-widget')
-rw-r--r--profile-widget/profilewidget2.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/profile-widget/profilewidget2.cpp b/profile-widget/profilewidget2.cpp
index da3eaad90..78bd294d4 100644
--- a/profile-widget/profilewidget2.cpp
+++ b/profile-widget/profilewidget2.cpp
@@ -1201,7 +1201,7 @@ void ProfileWidget2::setProfileState()
ccrsensor1GasItem->setVisible(sensorflag);
ccrsensor2GasItem->setVisible(sensorflag && (current_dc->no_o2sensors > 1));
ccrsensor3GasItem->setVisible(sensorflag && (current_dc->no_o2sensors > 2));
- ocpo2GasItem->setVisible((current_dc->divemode == PSCR) && prefs.show_scr_ocpo2);
+ ocpo2GasItem->setVisible(current_dive && (current_dc->divemode == PSCR) && prefs.show_scr_ocpo2);
heartBeatItem->setVisible(prefs.hrgraph);
diveCeiling->setVisible(prefs.calcceiling);