Use the correct dive to create the gas list

If we are adding a dive, it's the stagingDive, otherwise it's the
current_dive that we need to look at.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2013-11-19 18:23:14 -08:00
parent c1f936f288
commit 28ad26e878

View file

@ -449,13 +449,14 @@ void DivePlannerPointsModel::copyCylinders(dive *d)
QStringList& DivePlannerPointsModel::getGasList()
{
struct dive *activeDive = isPlanner() ? stagingDive : current_dive;
static QStringList list;
list.clear();
if (!stagingDive) {
if (!activeDive) {
list.push_back(tr("AIR"));
} else {
for (int i = 0; i < MAX_CYLINDERS; i++) {
cylinder_t *cyl = &stagingDive->cylinder[i];
cylinder_t *cyl = &activeDive->cylinder[i];
if (cylinder_nodata(cyl))
break;
list.push_back(gasToStr(cyl->gasmix.o2.permille, cyl->gasmix.he.permille));