summaryrefslogtreecommitdiffstats
path: root/desktop-widgets
diff options
context:
space:
mode:
authorGravatar Robert C. Helling <helling@atdotde.de>2017-01-16 09:54:15 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-01-18 06:50:01 -0800
commitdbf13900941830103311bb58cf88187f24bfc420 (patch)
tree74eed68654d52fdbae00fa6f7a10d39c64066382 /desktop-widgets
parent22267762ce2d92064733a94e66caf9d617089ab2 (diff)
downloadsubsurface-dbf13900941830103311bb58cf88187f24bfc420.tar.gz
Only set surface pressure when it has a value
When replanning a dive, do not set the surface pressure when it is 0. Same for salinity. This closes #161 . Signed-off-by: Robert C. Helling <helling@atdotde.de>
Diffstat (limited to 'desktop-widgets')
-rw-r--r--desktop-widgets/mainwindow.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp
index fa30188c2..194147639 100644
--- a/desktop-widgets/mainwindow.cpp
+++ b/desktop-widgets/mainwindow.cpp
@@ -927,8 +927,10 @@ void MainWindow::on_actionReplanDive_triggered()
setApplicationState("PlanDive");
divePlannerWidget()->setReplanButton(true);
divePlannerWidget()->setupStartTime(QDateTime::fromMSecsSinceEpoch(1000 * current_dive->when, Qt::UTC));
- divePlannerWidget()->setSurfacePressure(current_dive->surface_pressure.mbar);
- divePlannerWidget()->setSalinity(current_dive->salinity);
+ if (current_dive->surface_pressure.mbar)
+ divePlannerWidget()->setSurfacePressure(current_dive->surface_pressure.mbar);
+ if (current_dive->salinity)
+ divePlannerWidget()->setSalinity(current_dive->salinity);
DivePlannerPointsModel::instance()->loadFromDive(current_dive);
reset_cylinders(&displayed_dive, true);
}