From ea2e517e39e849c7b1e949f87ad263dc13c47714 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Mon, 11 Nov 2013 05:54:04 +0900 Subject: [PATCH] Fix crash when cancelling dive add on empty dive list Don't pass NULL dives around. Fixes #231 Signed-off-by: Dirk Hohndel --- qt-ui/models.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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];