diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index b7c2132a75..ac31cb7f69 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -2336,7 +2336,8 @@ long wxListMainWindow::GetNextItem( long item, int state ) { long ret = item; - wxCHECK_MSG( ret < GetItemCount(), -1, _T("invalid listctrl index") ); + wxCHECK_MSG( (ret == -1) || ((int)ret < GetItemCount()), -1, + _T("invalid listctrl index in GetNextItem()") ); // notice that we start with the next item (or the first one if item == -1) // and this is intentional to allow writing a simple loop to iterate over