summaryrefslogtreecommitdiffstats
path: root/qt-ui/diveplanner.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2014-01-26 07:22:02 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-01-26 07:22:54 -0800
commitf11001ff4ee478453714df7ed1efdb8a1aa7fbde (patch)
treec576d8e00235b66b8b3c5ed31f47b28c5cb4f4da /qt-ui/diveplanner.cpp
parentd7604932992cfacf24b0316b6e1df6e5e34abada (diff)
downloadsubsurface-f11001ff4ee478453714df7ed1efdb8a1aa7fbde.tar.gz
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>
Diffstat (limited to 'qt-ui/diveplanner.cpp')
-rw-r--r--qt-ui/diveplanner.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp
index 4ff6894e6..0209b2e1e 100644
--- a/qt-ui/diveplanner.cpp
+++ b/qt-ui/diveplanner.cpp
@@ -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