assert in GetNextItem() fixed (yes, now it is)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5663 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -2335,14 +2335,23 @@ long wxListMainWindow::GetNextItem( long item,
|
|||||||
int WXUNUSED(geometry),
|
int WXUNUSED(geometry),
|
||||||
int state )
|
int state )
|
||||||
{
|
{
|
||||||
long ret = item;
|
long ret = item,
|
||||||
wxCHECK_MSG( (ret == -1) || ((int)ret < GetItemCount()), -1,
|
max = GetItemCount();
|
||||||
|
wxCHECK_MSG( (ret == -1) || (ret < max), -1,
|
||||||
_T("invalid listctrl index in GetNextItem()") );
|
_T("invalid listctrl index in GetNextItem()") );
|
||||||
|
|
||||||
// notice that we start with the next item (or the first one if item == -1)
|
// 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
|
// and this is intentional to allow writing a simple loop to iterate over
|
||||||
// all selected items
|
// all selected items
|
||||||
wxNode *node = m_lines.Nth( (size_t)++ret );
|
ret++;
|
||||||
|
if ( ret == max )
|
||||||
|
{
|
||||||
|
// this is not an error because the index was ok initially, just no
|
||||||
|
// such item
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxNode *node = m_lines.Nth( (size_t)ret );
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
wxListLineData *line = (wxListLineData*)node->Data();
|
wxListLineData *line = (wxListLineData*)node->Data();
|
||||||
|
Reference in New Issue
Block a user