summaryrefslogtreecommitdiffstats
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-03 10:56:29 -0800
commita30a0910b485c10536130a627b836a0f5b784ce7 (patch)
tree59d2092e621f675e3d16471384e52d44770d3ef7 /qt-ui/maintab.cpp
parenta62f68e9059730acbe366c7740911f396e84dd91 (diff)
downloadsubsurface-a30a0910b485c10536130a627b836a0f5b784ce7.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 07c21b2b5..fb37992b1 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