From f4f42a0b97182681d92c991482fa2064251f7ac7 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Thu, 29 Jun 2017 14:27:45 -0700 Subject: 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 --- qt-models/diveimportedmodel.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'qt-models') 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++) { -- cgit v1.2.3-70-g09d2