]> git.saurik.com Git - wxWidgets.git/commitdiff
check the item id validity in SetItem()
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 13 May 2006 11:48:12 +0000 (11:48 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 13 May 2006 11:48:12 +0000 (11:48 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39149 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/listctrl.cpp

index 525d9122be7d49f99b4189841ccf71f43a813a42..33c6741c598186090c68dbabd29690c19557dbb9 100644 (file)
@@ -761,6 +761,10 @@ bool wxListCtrl::GetItem(wxListItem& info) const
 // Sets information about the item
 bool wxListCtrl::SetItem(wxListItem& info)
 {
+    const long id = info.GetId();
+    wxCHECK_MSG( id >= 0 && id < GetItemCount(), false,
+                 _T("invalid item index in SetItem") );
+
     LV_ITEM item;
     wxConvertToMSWListItem(this, info, item);
 
@@ -773,7 +777,7 @@ bool wxListCtrl::SetItem(wxListItem& info)
     {
         // get internal item data
         // perhaps a cache here ?
-        wxListItemInternalData *data = wxGetInternalData(this, info.m_itemId);
+        wxListItemInternalData *data = wxGetInternalData(this, id);
 
         if (! data)
         {