]> git.saurik.com Git - wxWidgets.git/commitdiff
Handle cases where an index larger than GetItemCount() is passed into InsertItem.
authorKevin Ollivier <kevino@theolliviers.com>
Tue, 19 Sep 2006 17:08:36 +0000 (17:08 +0000)
committerKevin Ollivier <kevino@theolliviers.com>
Tue, 19 Sep 2006 17:08:36 +0000 (17:08 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41304 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/mac/carbon/listctrl_mac.cpp

index faa0a9c771ad0a026c2662ee48802877b3e49750..43c0ecb32b77ab88ef8665446aebe58b85dea59f 100644 (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 );