X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f6bcfd974ef26faf6f91a62cac09827e09463fd1..7a766dcda16f3eaaa9f26d5e147e958b24d175b0:/src/generic/imaglist.cpp

diff --git a/src/generic/imaglist.cpp b/src/generic/imaglist.cpp
index 12f621afce..64995176e2 100644
--- a/src/generic/imaglist.cpp
+++ b/src/generic/imaglist.cpp
@@ -68,15 +68,16 @@ int wxImageList::Add( const wxBitmap &bitmap )
 int wxImageList::Add( const wxBitmap& bitmap, const wxBitmap& mask )
 {
     wxBitmap bmp(bitmap);
-    bmp.SetMask(new wxMask(mask));
+    if (mask.Ok())
+        bmp.SetMask(new wxMask(mask));
     return Add(bmp);
 }
 
 int wxImageList::Add( const wxBitmap& bitmap, const wxColour& maskColour )
 {
-    wxImage img(bitmap);
+    wxImage img = bitmap.ConvertToImage();
     img.SetMaskColour(maskColour.Red(), maskColour.Green(), maskColour.Blue());
-    return Add(img.ConvertToBitmap());
+    return Add(wxBitmap(img));
 }
 
 const wxBitmap *wxImageList::GetBitmap( int index ) const