Handle cases where an index larger than GetItemCount() is passed into InsertItem.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41304 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Kevin Ollivier
2006-09-19 17:08:36 +00:00
parent 3966a9f4f8
commit e42667e599

View File

@@ -1024,6 +1024,11 @@ long wxListCtrl::InsertItem(wxListItem& info)
return m_genericImpl->InsertItem(info);
if (m_dbImpl){
int count = GetItemCount();
if (info.m_itemId > count)
info.m_itemId = count;
m_dbImpl->MacInsertItem(info.m_itemId, &info );
wxListEvent event( wxEVT_COMMAND_LIST_INSERT_ITEM, GetId() );
event.SetEventObject( this );