From a30a0910b485c10536130a627b836a0f5b784ce7 Mon Sep 17 00:00:00 2001 From: "Lubomir I. Ivanov" Date: Fri, 3 Jan 2014 14:49:17 +0200 Subject: [PATCH] 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 Signed-off-by: Dirk Hohndel --- qt-ui/maintab.cpp | 1 + 1 file changed, 1 insertion(+) 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