From 2910327ef318f655171bb8c0b0db3a0529a9da0a Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 18 Oct 2021 11:48:11 +0200 Subject: [PATCH] Don't crash in wxOSXGetImageFromBundle() if the bundle is invalid Just return a null image instead, as this function can be called when we don't have any bitmaps too -- as it happens in the Button::Bitmap unit test, for example. --- src/osx/core/bmpbndl.mm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/osx/core/bmpbndl.mm b/src/osx/core/bmpbndl.mm index d41db453c6..7fdb89a78a 100644 --- a/src/osx/core/bmpbndl.mm +++ b/src/osx/core/bmpbndl.mm @@ -171,6 +171,9 @@ wxBitmapBundle wxBitmapBundle::FromResources(const wxString& name) WXImage wxOSXGetImageFromBundle(const wxBitmapBundle& bundle) { + if (!bundle.IsOk()) + return NULL; + WXImage image = bundle.GetImpl()->OSXGetImage(); if (image == 0)