Don't dereference NULL pointer when adding tanks to a dive plan

The code was obviously bogus before.

Fixes #429

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2014-01-26 07:22:02 -08:00
parent d760493299
commit f11001ff4e

View file

@ -1429,11 +1429,13 @@ void DivePlannerPointsModel::createTemporaryPlan()
cylinder_t *cyl = &stagingDive->cylinder[i];
if (cyl->depth.mm) {
dp = create_dp(0, cyl->depth.mm, cyl->gasmix.o2.permille, cyl->gasmix.he.permille, 0);
if (diveplan.dp)
if (diveplan.dp) {
dp->next = diveplan.dp->next;
else
diveplan.dp->next = dp;
} else {
dp->next = NULL;
diveplan.dp->next = dp;
diveplan.dp = dp;
}
}
}
#if DEBUG_PLAN