check the item id validity in SetItem()

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39149 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2006-05-13 11:48:12 +00:00
parent f8a29d4f6e
commit 4ce04fd883

View File

@@ -761,6 +761,10 @@ bool wxListCtrl::GetItem(wxListItem& info) const
// Sets information about the item // Sets information about the item
bool wxListCtrl::SetItem(wxListItem& info) 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; LV_ITEM item;
wxConvertToMSWListItem(this, info, item); wxConvertToMSWListItem(this, info, item);
@@ -773,7 +777,7 @@ bool wxListCtrl::SetItem(wxListItem& info)
{ {
// get internal item data // get internal item data
// perhaps a cache here ? // perhaps a cache here ?
wxListItemInternalData *data = wxGetInternalData(this, info.m_itemId); wxListItemInternalData *data = wxGetInternalData(this, id);
if (! data) if (! data)
{ {