From dbcf044b938335484d4496c3cbaa87a8af9fa37e Mon Sep 17 00:00:00 2001 From: Jan Mulder Date: Sun, 24 Dec 2017 14:28:04 +0100 Subject: 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 --- qt-models/divepicturemodel.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'qt-models') 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 -- cgit v1.2.3-70-g09d2