From 032c443c423286afd7e62e0942ed83c4061efacd Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Sun, 4 Apr 2021 21:05:06 +0200 Subject: [PATCH] Report failure while creating generic wxImageList with invalid image size Native wxMSW implementation reports failure if dimensions <= 0. --- src/generic/imaglist.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/generic/imaglist.cpp b/src/generic/imaglist.cpp index 94a7781eaa..54582cc268 100644 --- a/src/generic/imaglist.cpp +++ b/src/generic/imaglist.cpp @@ -46,11 +46,13 @@ int wxGenericImageList::GetImageCount() const bool wxGenericImageList::Create( int width, int height, bool mask, int WXUNUSED(initialCount) ) { - m_size = wxSize(width, height); + // Prevent from storing negative dimensions + m_size = wxSize(wxMax(width, 0), wxMax(height, 0)); m_useMask = mask; m_scaleFactor = 1.0; - return true; + // Images must have proper size + return m_size != wxSize(0, 0); } namespace