summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Jan Mulder <jlmulder@xs4all.nl>2017-12-24 14:28:04 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-12-24 08:25:21 -0800
commitdbcf044b938335484d4496c3cbaa87a8af9fa37e (patch)
tree1fe0d710e47cec423a655a360e4f85f1eeac4d7c
parent7451517e4a5e9aeffe31f1cd7346b07c0c9e15ac (diff)
downloadsubsurface-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.cpp6
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