summaryrefslogtreecommitdiffstats
path: root/qt-ui/diveplanner.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2013-11-18 10:46:01 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-11-18 10:46:01 -0800
commit3801b765fff847adff1899c7d54484b0bb100c87 (patch)
treee46792117545e4dd00b2dadb7d9e2c1a49122fa7 /qt-ui/diveplanner.cpp
parent7d0cc6b337f242be2d15744465cc6adec5937193 (diff)
downloadsubsurface-3801b765fff847adff1899c7d54484b0bb100c87.tar.gz
Don't add spurious 5m/15ft node at 10 minutes when canceling edit
When cancelling the edit of a manually added dive, we should send the sample with timestamp 0 to addStop - that's a magic value and causes us to add a node at 5m/15ft and 10 minutes instead. Since the dive always starts at the surface, calling addStop is redundant, anyway, so let's just not do that. See #270 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/diveplanner.cpp')
-rw-r--r--qt-ui/diveplanner.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp
index 643f35a2d..39fe0548f 100644
--- a/qt-ui/diveplanner.cpp
+++ b/qt-ui/diveplanner.cpp
@@ -1416,9 +1416,11 @@ void DivePlannerPointsModel::undoEdition()
{
clear();
Q_FOREACH(const sample &s, backupSamples){
- int o2, he;
- get_gas_from_events(&current_dive->dc, s.time.seconds, &o2, &he);
- plannerModel->addStop(s.depth.mm, s.time.seconds, o2, he, 0);
+ if (s.time.seconds > 0) {
+ int o2, he;
+ get_gas_from_events(&current_dive->dc, s.time.seconds, &o2, &he);
+ plannerModel->addStop(s.depth.mm, s.time.seconds, o2, he, 0);
+ }
}
}