aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2013-09-22 07:05:03 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-09-22 07:05:03 -0700
commit765e5b76e6089d12e2328bfc058f27e187076bd4 (patch)
tree32914482477fd31c12ef9fdd5645ac68514c4248
parent21b7ebbaf002531152977d5a10bf7c74704d28ed (diff)
downloadsubsurface-765e5b76e6089d12e2328bfc058f27e187076bd4.tar.gz
Fix crash when closing the data file
Only dereference the dive pointer if there actually is a dive. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--qt-ui/maintab.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
index b4ee10873..3af6a0f40 100644
--- a/qt-ui/maintab.cpp
+++ b/qt-ui/maintab.cpp
@@ -241,11 +241,11 @@ void MainTab::updateDiveInfo(int dive)
UPDATE_TEXT(d, buddy);
UPDATE_TEMP(d, airtemp);
UPDATE_TEMP(d, watertemp);
- ui->dateTimeEdit->setDateTime(QDateTime::fromTime_t(d->when - gettimezoneoffset()));
if (d) {
char buffer[256];
print_gps_coordinates(buffer, sizeof buffer, d->latitude.udeg, d->longitude.udeg);
ui->coordinates->setText(buffer);
+ ui->dateTimeEdit->setDateTime(QDateTime::fromTime_t(d->when - gettimezoneoffset()));
if (mainWindow() && mainWindow()->dive_list()->selectedTrips.count() == 1) {
// only use trip relevant fields
ui->coordinates->setVisible(false);