diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2014-01-26 07:22:02 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-01-26 07:22:54 -0800 |
commit | f11001ff4ee478453714df7ed1efdb8a1aa7fbde (patch) | |
tree | c576d8e00235b66b8b3c5ed31f47b28c5cb4f4da /qt-ui/diveplanner.cpp | |
parent | d7604932992cfacf24b0316b6e1df6e5e34abada (diff) | |
download | subsurface-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.cpp | 8 |
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 |