From 3466d0c44da062b3accdfa8ccca450af16ba967a Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sat, 20 Nov 2021 09:00:15 +0100 Subject: [PATCH] cylinders: remove redundant index check in the model There is a warning when the code tries to access a non-existing cylinder, since that indicates that something went out of sync. However, this warning can never trigger because the bounds are checked before. Remove the first of the two redundant checks. Signed-off-by: Berthold Stoeger --- qt-models/cylindermodel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qt-models/cylindermodel.cpp b/qt-models/cylindermodel.cpp index b2140132d..cb1bbf1f7 100644 --- a/qt-models/cylindermodel.cpp +++ b/qt-models/cylindermodel.cpp @@ -152,7 +152,7 @@ bool CylindersModel::cylinderUsed(int i) const QVariant CylindersModel::data(const QModelIndex &index, int role) const { - if (!d || !index.isValid() || index.row() >= d->cylinders.nr) + if (!d || !index.isValid()) return QVariant(); if (index.row() >= d->cylinders.nr) {