From 85557d818d9b79cb01cdd27194312cd1992331e5 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 7 Dec 2018 03:58:54 +0100 Subject: [PATCH] Replace a silent "impossible" return with a wxCHECK_RET() Instead of writing a comment saying that something is not supposed to happen, add an assertion verifying that it actually doesn't happen. --- src/generic/rowheightcache.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) 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)