From: Vadim Zeitlin Date: Thu, 21 Jul 2011 13:50:10 +0000 (+0000) Subject: Correct test for maximal row index in generic wxDataViewCtrl. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/4385e702963373bf015f5a9dbad95c9b9c2e0809?ds=inline Correct test for maximal row index in generic wxDataViewCtrl. The comparison in EVT_CHAR handler was incorrect for an empty control without any rows as it subtracting 1 from 0 resulted in UINT_MAX and not -1 as all the values were unsigned. Fix this by checking that the new row is valid instead, this is correct for both signed and unsigned values. Closes #13356. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68320 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/generic/datavgen.cpp b/src/generic/datavgen.cpp index 7172780600..84834e7beb 100644 --- a/src/generic/datavgen.cpp +++ b/src/generic/datavgen.cpp @@ -3374,7 +3374,7 @@ void wxDataViewMainWindow::OnChar( wxKeyEvent &event ) break; case WXK_DOWN: - if ( m_currentRow < GetRowCount() - 1 ) + if ( m_currentRow + 1 < GetRowCount() ) OnArrowChar( m_currentRow + 1, event ); break; // Add the process for tree expanding/collapsing