Fix crash with empty dive list

Don't access current_dc unless there is a valid current_dive.

Fixes #817

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2015-01-24 14:42:25 -08:00
parent b8b15165f0
commit d9fd4cb69b

View file

@ -981,7 +981,7 @@ void ProfileWidget2::setProfileState()
po2GasItem->setVisible(prefs.pp_graphs.po2);
pheGasItem->setVisible(prefs.pp_graphs.phe);
bool setpointflag = (current_dc->divemode == CCR) && prefs.pp_graphs.po2 && current_dive;
bool setpointflag = current_dive && (current_dc->divemode == CCR) && prefs.pp_graphs.po2;
bool sensorflag = setpointflag && prefs.show_ccr_sensors;
o2SetpointGasItem->setVisible(setpointflag && prefs.show_ccr_setpoint);
ccrsensor1GasItem->setVisible(sensorflag);