aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/maintab.cpp
diff options
context:
space:
mode:
authorGravatar Lubomir I. Ivanov <neolit123@gmail.com>2014-01-03 14:49:17 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-01-09 09:27:00 +0800
commit6719e45704d8694d845bc4e8bc3970e21bdab23b (patch)
tree642465a7672a20e6b362075d2bd8889d8993c0eb /qt-ui/maintab.cpp
parent7771158c82c0d9da51d417e9c0a2d69c9dce4818 (diff)
downloadsubsurface-6719e45704d8694d845bc4e8bc3970e21bdab23b.tar.gz
Maintab: prevent a segfault in the 'Equipment' tab
When a dive contains no cylinders, clicking the '+' button could SIGSEGV if current_dive->dc.model is NULL. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/maintab.cpp')
-rw-r--r--qt-ui/maintab.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
index 4fc543fc0..8da113700 100644
--- a/qt-ui/maintab.cpp
+++ b/qt-ui/maintab.cpp
@@ -223,6 +223,7 @@ void MainTab::enableEdition(EditMode newEditMode)
if (current_dive == NULL || editMode != NONE)
return;
if ((newEditMode == DIVE || newEditMode == NONE) &&
+ current_dive->dc.model &&
strcmp(current_dive->dc.model, "manually added dive") == 0) {
// editCurrentDive will call enableEdition with newEditMode == MANUALLY_ADDED_DIVE
// so exit this function here after editCurrentDive() returns