From 133e1043937e20de592e14de5666bd2a00efb82b Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Tue, 15 Jul 2014 03:20:23 -0700 Subject: [PATCH] Planner: when adding new waypoint at the end, use previous gas In commit b0da8c270736 ("When adding a waypoint, use the gasmix of the _next_ waypoint.") we default to air when adding a waypoint at the end of the plan by double-clicking. That seems silly since we could instead continue using the last gas. I wasn't able to reproduce the "gas list disappears" problem in bug #623, but I did get a silly air segment added which was equally wrong. Maybe I'm lucky and this fixes the problem that Henrik sees as well... See #623 Signed-off-by: Dirk Hohndel --- qt-ui/diveplanner.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp index 1d0b27869..b099cbe40 100644 --- a/qt-ui/diveplanner.cpp +++ b/qt-ui/diveplanner.cpp @@ -829,6 +829,8 @@ int DivePlannerPointsModel::addStop(int milimeters, int seconds, gasmix *gas_in, if (usePrevious) { if (row < divepoints.count()) { gas = divepoints.at(row).gasmix; + } else if (row > 0) { + gas = divepoints.at(row - 1).gasmix; } else { if (!addGas(air)) qDebug("addGas failed"); // FIXME add error propagation