From 4ce04fd8831f4c0b4edd9c454818406d74e5fafc Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 13 May 2006 11:48:12 +0000 Subject: [PATCH] check the item id validity in SetItem() git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39149 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/msw/listctrl.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/msw/listctrl.cpp b/src/msw/listctrl.cpp index 525d9122be..33c6741c59 100644 --- a/src/msw/listctrl.cpp +++ b/src/msw/listctrl.cpp @@ -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) { -- 2.45.2