summaryrefslogtreecommitdiffstats
path: root/desktop-widgets/divelogimportdialog.cpp
diff options
context:
space:
mode:
authorGravatar Miika Turkia <miika.turkia@gmail.com>2017-09-11 06:46:13 +0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-09-11 07:21:43 -0700
commitf3ab2ee674846ea2934de5cd6e2822cdb5143421 (patch)
tree6f0631fdbaea81eb83989f100095c79746e662df /desktop-widgets/divelogimportdialog.cpp
parent40cc0b0e4bacde90c296472c687cf0bef603fd66 (diff)
downloadsubsurface-f3ab2ee674846ea2934de5cd6e2822cdb5143421.tar.gz
Fix crash on manually added ZXU/DL7 file
The CSV import crashed if the input file had no samples in it. Fixes #566 Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Diffstat (limited to 'desktop-widgets/divelogimportdialog.cpp')
-rw-r--r--desktop-widgets/divelogimportdialog.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/desktop-widgets/divelogimportdialog.cpp b/desktop-widgets/divelogimportdialog.cpp
index e4f4899eb..6473e46ed 100644
--- a/desktop-widgets/divelogimportdialog.cpp
+++ b/desktop-widgets/divelogimportdialog.cpp
@@ -737,7 +737,9 @@ void DiveLogImportDialog::loadFileContents(int value, whatChanged triggeredBy)
fileColumns.append(currColumns);
rows += 1;
}
- resultModel->setColumnValues(fileColumns);
+
+ if (rows > 0)
+ resultModel->setColumnValues(fileColumns);
for (int i = 0; i < headers.count(); i++)
if (!headers.at(i).isEmpty())
resultModel->setData(resultModel->index(0, i),headers.at(i),Qt::EditRole);