From 341eb05f835a3e41100917d39c9eaf1a1a28a55f Mon Sep 17 00:00:00 2001 From: "Lubomir I. Ivanov" Date: Sat, 25 Oct 2014 11:33:31 +0300 Subject: MainWindow: prevent a possible crash on "re-plan" MainWindow::on_actionReplanDive_triggered(): If a dive in the divelist does not have a "DC Model" for some reason, selecting "re-plan" from the menu will pass a NULL value current_dive->dc.model to strcmp() and break before the debug output. To fix that we check if the said .model value is NULL. Signed-off-by: Lubomir I. Ivanov Signed-off-by: Dirk Hohndel --- qt-ui/mainwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'qt-ui') diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp index cb1ffea2d..53c24a099 100644 --- a/qt-ui/mainwindow.cpp +++ b/qt-ui/mainwindow.cpp @@ -451,7 +451,7 @@ void MainWindow::on_actionReplanDive_triggered() { if (!plannerStateClean()) return; - if (!current_dive || strcmp(current_dive->dc.model, "planned dive")) { + if (!current_dive || !current_dive->dc.model || strcmp(current_dive->dc.model, "planned dive")) { qDebug() << current_dive->dc.model; return; } -- cgit v1.2.3-70-g09d2