diff options
-rw-r--r-- | qt-ui/divelogimportdialog.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/qt-ui/divelogimportdialog.cpp b/qt-ui/divelogimportdialog.cpp index 4fb9b30d2..5ee964f72 100644 --- a/qt-ui/divelogimportdialog.cpp +++ b/qt-ui/divelogimportdialog.cpp @@ -217,7 +217,12 @@ QVariant ColumnNameResult::data(const QModelIndex &index, int role) const if (index.row() == 0) { return (columnNames[index.column()]); } - return QVariant(columnValues[index.row() -1][index.column()]); + // make sure the element exists before returning it - this might get called before the + // model is correctly set up again (e.g., when changing separators) + if (columnValues.count() > index.row() - 1 && columnValues[index.row() - 1].count() > index.column()) + return QVariant(columnValues[index.row() - 1][index.column()]); + else + return QVariant(); } int ColumnNameResult::rowCount(const QModelIndex &parent) const |