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>
This commit is contained in:
Dirk Hohndel 2013-05-08 10:51:15 -07:00
parent df01a5d35f
commit 661aa67e89

View file

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