[PATCH 2/2] Maintab: prevent a segfault in the 'Equipment' tab
Lubomir I. Ivanov
neolit123 at gmail.com
Fri Jan 3 04:49:17 UTC 2014
From: "Lubomir I. Ivanov" <neolit123 at gmail.com>
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 at gmail.com>
---
newEditMode=MainTab::NONE) at qt-ui/maintab.cpp:225
at qt-ui/maintab.cpp:546
...
---
qt-ui/maintab.cpp | 1 +
1 file changed, 1 insertion(+)
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
index 4fc543f..8da1137 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
--
1.7.11.msysgit.0
More information about the subsurface
mailing list