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>
This commit is contained in:
Berthold Stoeger 2018-05-02 13:21:00 +02:00 committed by Lubomir I. Ivanov
parent 12e4b6d62c
commit fb84b11854

View file

@ -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);