This shouldn't normally happen, but if some bug causes it, detect it.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68598
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
{
sel.Empty();
wxDataViewSelection selection = m_clientArea->GetSelections();
- int len = selection.GetCount();
- for( int i = 0; i < len; i ++)
+
+ for ( wxDataViewSelection::const_iterator i = selection.begin();
+ i != selection.end();
+ ++i )
{
- unsigned int row = selection[i];
- sel.Add( m_clientArea->GetItemByRow( row ) );
+ wxDataViewItem item = m_clientArea->GetItemByRow(*i);
+ if ( item.IsOk() )
+ {
+ sel.Add(item);
+ }
+ else
+ {
+ wxFAIL_MSG( "invalid item in selection - bad internal state" );
+ }
}
- return len;
+
+ return sel.size();
}
void wxDataViewCtrl::SetSelections( const wxDataViewItemArray & sel )