From e8952aba2914722b0ad0e6f07e2193ead7f2e39d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Lund=20Martsum?= Date: Thu, 23 Feb 2012 09:56:12 +0100 Subject: QHeaderView - change not needed if to Q_ASSERT This removes an if that should always be false. If it isn't false we had more logical indexes than sections. Unless visualIndices and logicalIndices are both 0-sized (meaning that visual and logical indexes are the same) then they better have exactly as many indexes as sectionCount. Otherwise there must be inconsistent data - some logicalindex would refer to non-existing visual sections or some visualindeces wouldn't be hit by logicalIndices. Change-Id: I2dc92f40895438d912bba20612131baf63df4fbe Reviewed-by: Stephen Kelly --- src/widgets/itemviews/qheaderview.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp index 6a1f949258..c457f16a2c 100644 --- a/src/widgets/itemviews/qheaderview.cpp +++ b/src/widgets/itemviews/qheaderview.cpp @@ -1802,9 +1802,8 @@ void QHeaderViewPrivate::_q_sectionsRemoved(const QModelIndex &parent, if (logicalFirst == logicalLast) { // Remove just one index. int l = logicalFirst; int visual = visualIndices.at(l); + Q_ASSERT(sectionCount == logicalIndices.count()); for (int v = 0; v < sectionCount; ++v) { - if (v >= logicalIndices.count()) - continue; // the section doesn't exist if (v > visual) { int logical = logicalIndices.at(v); --(visualIndices[logical]); -- cgit v1.2.3