From fb84b1185428dd8557bba915c6a018657b92ad2f Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Wed, 2 May 2018 13:21:00 +0200 Subject: Profile: Fix crash on addition of dive to fresh logbook MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If there is no current dive, the macro current_dc returns NULL. This led to a null-pointer dereference. Reported-by: Martin Měřinský Signed-off-by: Berthold Stoeger --- profile-widget/profilewidget2.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); -- cgit v1.2.3-70-g09d2