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:
@@ -1429,11 +1429,13 @@ void DivePlannerPointsModel::createTemporaryPlan()
|
|||||||
cylinder_t *cyl = &stagingDive->cylinder[i];
|
cylinder_t *cyl = &stagingDive->cylinder[i];
|
||||||
if (cyl->depth.mm) {
|
if (cyl->depth.mm) {
|
||||||
dp = create_dp(0, cyl->depth.mm, cyl->gasmix.o2.permille, cyl->gasmix.he.permille, 0);
|
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;
|
dp->next = diveplan.dp->next;
|
||||||
else
|
diveplan.dp->next = dp;
|
||||||
|
} else {
|
||||||
dp->next = NULL;
|
dp->next = NULL;
|
||||||
diveplan.dp->next = dp;
|
diveplan.dp = dp;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if DEBUG_PLAN
|
#if DEBUG_PLAN
|
||||||
|
|||||||
Reference in New Issue
Block a user