From 17bcd1bc6085013877888792754f52ce6b375aea Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Fri, 18 Jul 2014 18:37:28 -0700 Subject: get_gas_at_time needs to always give us a valid gas Before this function was changed it was really supposed to just change a gas that was passed in in case there was an event that changed the mix - but with the new name the caller will assume that they get a valid gasmix. And promptly we had one caller that didn't initialize gas to be based on the first cylinder before calling get_gas_at_time(). Instead of adding yet one more spot that knows about the oddity of the old API I simply changed get_gas_at_time() to do what it name appears to imply and fixed the other callers not to bother to initialize the gasmix. Fixes #647 Signed-off-by: Dirk Hohndel --- qt-ui/diveplanner.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'qt-ui') diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp index 8bd32f457..285347237 100644 --- a/qt-ui/diveplanner.cpp +++ b/qt-ui/diveplanner.cpp @@ -106,8 +106,7 @@ void DivePlannerPointsModel::loadFromDive(dive *d) { CylindersModel::instance()->updateDive(); duration_t lasttime = {}; - // we start with the first gas and see if it was changed - struct gasmix gas = d->cylinder[0].gasmix; + struct gasmix gas; for (int i = 0; i < d->dc.samples - 1; i++) { const sample &s = d->dc.sample[i]; if (s.time.seconds == 0) -- cgit v1.2.3-70-g09d2