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:
Artur Wieczorek
2021-04-04 21:09:40 +02:00
parent b6f4e5cf59
commit 94ed0463d0

View File

@@ -265,6 +265,9 @@ wxGenericImageList::Replace(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);
return true;