diff options
author | Jan Mulder <jlmulder@xs4all.nl> | 2017-12-24 14:28:04 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2017-12-24 08:25:21 -0800 |
commit | dbcf044b938335484d4496c3cbaa87a8af9fa37e (patch) | |
tree | 1fe0d710e47cec423a655a360e4f85f1eeac4d7c | |
parent | 7451517e4a5e9aeffe31f1cd7346b07c0c9e15ac (diff) | |
download | subsurface-dbcf044b938335484d4496c3cbaa87a8af9fa37e.tar.gz |
beginInsertRows requires last >= first
Found while compiled against Qt 5.10 build from source. The assert
Q_ASSERT(last >= first) is trapped by this beginInsertRows in
case there are no pictures. Just do not call this when there are
no pictures.
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
-rw-r--r-- | qt-models/divepicturemodel.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/qt-models/divepicturemodel.cpp b/qt-models/divepicturemodel.cpp index 47e64492b..ef60001b4 100644 --- a/qt-models/divepicturemodel.cpp +++ b/qt-models/divepicturemodel.cpp @@ -108,8 +108,10 @@ void DivePictureModel::updateDivePictures() updateThumbnails(); - beginInsertRows(QModelIndex(), 0, pictures.count() - 1); - endInsertRows(); + if (!pictures.isEmpty()) { + beginInsertRows(QModelIndex(), 0, pictures.count() - 1); + endInsertRows(); + } } int DivePictureModel::columnCount(const QModelIndex &parent) const |