diff options
-rw-r--r-- | qt-ui/models.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/qt-ui/models.cpp b/qt-ui/models.cpp index 3d1936eea..df2732cc4 100644 --- a/qt-ui/models.cpp +++ b/qt-ui/models.cpp @@ -323,12 +323,13 @@ void CylindersModel::setDive(dive* d) break; } } - - beginInsertRows(QModelIndex(), 0, amount-1); rows = amount; current = d; changed = false; - endInsertRows(); + if (amount > 0) { + beginInsertRows(QModelIndex(), 0, amount - 1); + endInsertRows(); + } } Qt::ItemFlags CylindersModel::flags(const QModelIndex& index) const @@ -504,12 +505,13 @@ void WeightModel::setDive(dive* d) break; } } - - beginInsertRows(QModelIndex(), 0, amount-1); rows = amount; current = d; changed = false; - endInsertRows(); + if (amount > 0) { + beginInsertRows(QModelIndex(), 0, amount - 1); + endInsertRows(); + } } WSInfoModel* WSInfoModel::instance() |