From: Kevin Ollivier Date: Tue, 19 Sep 2006 17:08:36 +0000 (+0000) Subject: Handle cases where an index larger than GetItemCount() is passed into InsertItem. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/e42667e599b94968e20f009ebdafbd20c048e610 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 --- diff --git a/src/mac/carbon/listctrl_mac.cpp b/src/mac/carbon/listctrl_mac.cpp index faa0a9c771..43c0ecb32b 100644 --- a/src/mac/carbon/listctrl_mac.cpp +++ b/src/mac/carbon/listctrl_mac.cpp @@ -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 );