summaryrefslogtreecommitdiffstats
path: root/qt-ui/mainwindow.cpp
diff options
context:
space:
mode:
authorGravatar Miika Turkia <miika.turkia@gmail.com>2015-10-08 18:59:37 +0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-10-08 16:42:27 -0700
commitc0ac73a478c5407467019d61ed2536bef90edd62 (patch)
tree8742e59a87f4fcddea7523841e87461ec22aab70 /qt-ui/mainwindow.cpp
parent640c746a1faa77ea13c93582c59b391f7e2816de (diff)
downloadsubsurface-c0ac73a478c5407467019d61ed2536bef90edd62.tar.gz
Fix a crash when editing manually added dive
I have manually added dives from an ancient version of Subsurface. Trying to edit these caused Subsurface to crash due to comparison of string of dc.model that did not exist (to a static string). And further down the execution path we were crashing as there were no samples associated with the dive. See #941 Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/mainwindow.cpp')
-rw-r--r--qt-ui/mainwindow.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
index 084c9f10f..d0f2f9127 100644
--- a/qt-ui/mainwindow.cpp
+++ b/qt-ui/mainwindow.cpp
@@ -798,7 +798,7 @@ void MainWindow::on_actionEditDive_triggered()
}
const bool isTripEdit = dive_list()->selectedTrips().count() >= 1;
- if (!current_dive || isTripEdit || strcmp(current_dive->dc.model, "manually added dive")) {
+ if (!current_dive || isTripEdit || (current_dive->dc.model && strcmp(current_dive->dc.model, "manually added dive"))) {
QMessageBox::warning(this, tr("Warning"), tr("Trying to edit a dive that's not a manually added dive."));
return;
}