mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Planner: don't abort when saving a dive
The fix for dereferencing a null pointer from me was a bad fix that broke the possibility of saving a planned dive as a dive. This is a better fix to not dereference a null pointer and be able to save the plan again. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
029522880f
commit
a84826090a
1 changed files with 4 additions and 3 deletions
|
@ -1422,8 +1422,6 @@ void DivePlannerPointsModel::createTemporaryPlan()
|
||||||
lastIndex = i;
|
lastIndex = i;
|
||||||
plan_add_segment(&diveplan, deltaT, p.depth, p.o2, p.he, p.po2);
|
plan_add_segment(&diveplan, deltaT, p.depth, p.o2, p.he, p.po2);
|
||||||
}
|
}
|
||||||
if (!diveplan.dp)
|
|
||||||
return;
|
|
||||||
char *cache = NULL;
|
char *cache = NULL;
|
||||||
tempDive = NULL;
|
tempDive = NULL;
|
||||||
const char *errorString = NULL;
|
const char *errorString = NULL;
|
||||||
|
@ -1432,7 +1430,10 @@ 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);
|
||||||
dp->next = diveplan.dp->next;
|
if (diveplan.dp)
|
||||||
|
dp->next = diveplan.dp->next;
|
||||||
|
else
|
||||||
|
dp->next = NULL;
|
||||||
diveplan.dp->next = dp;
|
diveplan.dp->next = dp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue