diff --git a/src/generic/rowheightcache.cpp b/src/generic/rowheightcache.cpp index f1e3e57768..c5fa2b665b 100644 --- a/src/generic/rowheightcache.cpp +++ b/src/generic/rowheightcache.cpp @@ -110,17 +110,16 @@ void RowRanges::Remove(const unsigned int row) void RowRanges::CleanUp(unsigned int idx) { size_t count = m_ranges.size(); + + wxCHECK_RET( idx < count, "Wrong index" ); + size_t rngIdx = 0; if (idx > 0) { // start one RowRange before rngIdx = idx - 1; } - if (idx >= count) - { - // should never reached, due CleanUp is private and internal called correctly - return; - } + RowRange *prevRng = &m_ranges[rngIdx]; rngIdx++; while (rngIdx <= idx + 1 && rngIdx < count)