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>
This commit is contained in:
Dirk Hohndel 2013-11-11 05:54:04 +09:00
parent e5098c443f
commit ea2e517e39

View file

@ -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];