summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2013-11-11 05:54:04 +0900
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-11-11 05:55:20 +0900
commitea2e517e39e849c7b1e949f87ad263dc13c47714 (patch)
treedc33ab2dbe67f33c595f19cda7c50b3598949cab
parente5098c443f55b1b21766538dc32fc56ef7fdb366 (diff)
downloadsubsurface-ea2e517e39e849c7b1e949f87ad263dc13c47714.tar.gz
Fix crash when cancelling dive add on empty dive list
Don't pass NULL dives around. Fixes #231 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--qt-ui/models.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/qt-ui/models.cpp b/qt-ui/models.cpp
index 0324fe4ba..22e422273 100644
--- a/qt-ui/models.cpp
+++ b/qt-ui/models.cpp
@@ -320,7 +320,8 @@ void CylindersModel::setDive(dive* d)
{
if (current)
clear();
-
+ if (!d)
+ return;
int amount = MAX_CYLINDERS;
for(int i = 0; i < MAX_CYLINDERS; i++) {
cylinder_t *cylinder = &d->cylinder[i];