diff options
Diffstat (limited to 'src/widgets/itemviews')
-rw-r--r-- | src/widgets/itemviews/qheaderview.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp index 26d7c5472a..708b9b44ca 100644 --- a/src/widgets/itemviews/qheaderview.cpp +++ b/src/widgets/itemviews/qheaderview.cpp @@ -2163,9 +2163,11 @@ void QHeaderViewPrivate::_q_sectionsAboutToBeChanged() layoutChangePersistentSections.clear(); layoutChangePersistentSections.reserve(std::min(10, sectionItems.count())); // after layoutChanged another section can be last stretched section - if (stretchLastSection) { + if (stretchLastSection && lastSectionLogicalIdx >= 0 && lastSectionLogicalIdx < sectionItems.count()) { const int visual = visualIndex(lastSectionLogicalIdx); - sectionItems[visual].size = lastSectionSize; + if (visual >= 0 && visual < sectionItems.size()) { + sectionItems[visual].size = lastSectionSize; + } } for (int i = 0; i < sectionItems.size(); ++i) { auto s = sectionItems.at(i); |