summaryrefslogtreecommitdiffstats
path: root/qt-models
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2017-06-29 14:27:45 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-06-29 15:10:42 -0700
commitf4f42a0b97182681d92c991482fa2064251f7ac7 (patch)
treedc11083370a7c903fee44309c1f5a4ac02768756 /qt-models
parent282698e5d25241e1c38fe7f455ca9f38b35ef590 (diff)
downloadsubsurface-f4f42a0b97182681d92c991482fa2064251f7ac7.tar.gz
Don't crash trying to record zero dives
If the user clicks "Accept" when no dives were downloaded we would otherwise dereference unitialized memory. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-models')
-rw-r--r--qt-models/diveimportedmodel.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/qt-models/diveimportedmodel.cpp b/qt-models/diveimportedmodel.cpp
index 799dd6ce6..66be4b5cf 100644
--- a/qt-models/diveimportedmodel.cpp
+++ b/qt-models/diveimportedmodel.cpp
@@ -163,6 +163,10 @@ void DiveImportedModel::repopulate()
void DiveImportedModel::recordDives()
{
+ if (diveTable->nr == 0)
+ // nothing to do, just exit
+ return;
+
// walk the table of imported dives and record the ones that the user picked
// clearing out the table as we go
for (int i = 0; i < rowCount(); i++) {