diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2015-01-06 20:27:49 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-01-06 20:35:57 -0800 |
commit | 925bb019c716ce5244765e54f1de584ece340b23 (patch) | |
tree | 73ee6d38e12c79e98177b2e6d1c5967031b8854a /qt-ui | |
parent | f42b986474b47bfcef78931c7744bb16f96c282e (diff) | |
download | subsurface-925bb019c716ce5244765e54f1de584ece340b23.tar.gz |
Fix potential crash
Commits 0de3bc845237 ("Display CCR setpoint values on the po2 graph") and
65eed80e3730 ("Don't always show the setpoint graph") didn't take into
account that current_dive could be NULL and therefore accessing current_dc
could crash.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r-- | qt-ui/profile/profilewidget2.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp index f17575d67..226580a48 100644 --- a/qt-ui/profile/profilewidget2.cpp +++ b/qt-ui/profile/profilewidget2.cpp @@ -531,7 +531,7 @@ void ProfileWidget2::plotDive(struct dive *d, bool force) currentdc = fake_dc(currentdc); } - if ((current_dc->dctype == CCR) && (prefs.show_ccr_setpoint)) + if (current_dive && (currentdc->dctype == CCR) && (prefs.show_ccr_setpoint)) o2SetpointGasItem->setVisible(true); else o2SetpointGasItem->setVisible(false); @@ -991,7 +991,7 @@ void ProfileWidget2::setProfileState() } pn2GasItem->setVisible(prefs.pp_graphs.pn2); po2GasItem->setVisible(prefs.pp_graphs.po2); - o2SetpointGasItem->setVisible((current_dc->dctype == CCR) && (prefs.show_ccr_setpoint)); + o2SetpointGasItem->setVisible(current_dive && (current_dc->dctype == CCR) && (prefs.show_ccr_setpoint)); pheGasItem->setVisible(prefs.pp_graphs.phe); timeAxis->setPos(itemPos.time.pos.on); |