Check if index is in the range prior to erasing the image from wxImageList
This is to avoid memory errors in wxVector.
This commit is contained in:
@@ -265,6 +265,9 @@ wxGenericImageList::Replace(int index,
|
|||||||
|
|
||||||
bool wxGenericImageList::Remove( int index )
|
bool wxGenericImageList::Remove( int index )
|
||||||
{
|
{
|
||||||
|
if ( index < 0 || (size_t)index >= m_images.size() )
|
||||||
|
return false;
|
||||||
|
|
||||||
m_images.erase(m_images.begin() + index);
|
m_images.erase(m_images.begin() + index);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
Reference in New Issue
Block a user