[PATCH] Fix null pointer dereference when adding fist dive
Anton Lundin
glance at acc.umu.se
Sat Sep 21 12:19:06 UTC 2013
If you have a blank history, we sugest now as time for the dive.
Signed-off-by: Anton Lundin <glance at acc.umu.se>
---
qt-ui/maintab.cpp | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
index b9a539f..382dbd7 100644
--- a/qt-ui/maintab.cpp
+++ b/qt-ui/maintab.cpp
@@ -241,9 +241,9 @@ 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];
+ ui->dateTimeEdit->setDateTime(QDateTime::fromTime_t(d->when - gettimezoneoffset()));
print_gps_coordinates(buffer, sizeof buffer, d->latitude.udeg, d->longitude.udeg);
ui->coordinates->setText(buffer);
if (mainWindow() && mainWindow()->dive_list()->selectedTrips.count() == 1) {
@@ -331,6 +331,8 @@ void MainTab::updateDiveInfo(int dive)
cylindersModel->setDive(d);
weightModel->setDive(d);
} else {
+ /* Set time to now */
+ ui->dateTimeEdit->setDateTime(QDateTime::currentDateTime());
/* clear the fields */
ui->rating->setCurrentStars(0);
ui->coordinates->clear();
--
1.8.1.2
More information about the subsurface
mailing list