From 661aa67e89ad7710f90482b074715c4d1448860a Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Wed, 8 May 2013 10:51:15 -0700 Subject: 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 Reported-by: Amit Chaudhuri Signed-off-by: Dirk Hohndel --- qt-ui/maintab.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'qt-ui/maintab.cpp') 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)); -- cgit v1.2.3-70-g09d2