From 4b7ca0b33d40eb4ee509a4220c42f15cfa849ab3 Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Sun, 4 Apr 2021 21:06:18 +0200 Subject: [PATCH] Add assertions to check if generic wxImageList is valid This is for compatibility with native wxMSW implementation. --- src/generic/imaglist.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/generic/imaglist.cpp b/src/generic/imaglist.cpp index 54582cc268..e2e9fc00a2 100644 --- a/src/generic/imaglist.cpp +++ b/src/generic/imaglist.cpp @@ -41,6 +41,8 @@ wxGenericImageList::~wxGenericImageList() int wxGenericImageList::GetImageCount() const { + wxASSERT_MSG( m_size != wxSize(0, 0), "Invalid image list" ); + return static_cast(m_images.size()); } @@ -275,6 +277,8 @@ bool wxGenericImageList::RemoveAll() bool wxGenericImageList::GetSize( int index, int &width, int &height ) const { + wxASSERT_MSG( m_size != wxSize(0, 0), "Invalid image list" ); + const wxBitmap* bmp = DoGetPtr(index); if ( !bmp ) {