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.
This commit is contained in:
Vadim Zeitlin
2018-12-07 03:58:54 +01:00
parent 7a949b4566
commit 85557d818d

View File

@@ -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)