diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2013-05-08 10:51:15 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-05-08 10:51:15 -0700 |
commit | 661aa67e89ad7710f90482b074715c4d1448860a (patch) | |
tree | 0ae4fdfbd00e6dd51c086574cc6b23b7aa7ed345 /qt-ui/maintab.cpp | |
parent | df01a5d35f620d2f33e4283863b729ed9554e23f (diff) | |
download | subsurface-661aa67e89ad7710f90482b074715c4d1448860a.tar.gz |
Avoid potential crash if no dive is selected
I missed to spots where we would unconditionally dereference the dive
pointer.
Reported-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Reported-by: Amit Chaudhuri <amit.k.chaudhuri@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/maintab.cpp')
-rw-r--r-- | qt-ui/maintab.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp index 89501fc07..078d59ca9 100644 --- a/qt-ui/maintab.cpp +++ b/qt-ui/maintab.cpp @@ -91,8 +91,8 @@ void MainTab::updateDiveInfo(int dive) ui->rating->setCurrentStars(d->rating); else ui->rating->setCurrentStars(0); - ui->maximumDepthText->setText(get_depth_string(d->maxdepth, TRUE)); - ui->averageDepthText->setText(get_depth_string(d->meandepth, TRUE)); + ui->maximumDepthText->setText(d ? get_depth_string(d->maxdepth, TRUE) : ""); + ui->averageDepthText->setText(d ? get_depth_string(d->meandepth, TRUE) : ""); sacVal.mliter = d ? d->sac : 0; ui->sacText->setText(get_volume_string(sacVal, TRUE).append("/min")); ui->otuText->setText(QString("%1").arg( d ? d->otu : 0)); |