git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1386 
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
        HBITMAP hBitmap2 = 0;
        if ( mask.Ok() )
            hBitmap2 = (HBITMAP) mask.GetHBITMAP();
-       return ImageList_Add((HIMAGELIST) GetHIMAGELIST(), hBitmap1, hBitmap2);
+
+    int index = ImageList_Add((HIMAGELIST) GetHIMAGELIST(), hBitmap1, hBitmap2);
+       if ( index == -1 )
+    {
+        wxLogError(_("Couldn't add an image to the image list."));
+    }
+
+    return index;
 }
 
 // Adds a bitmap, using the specified colour to create the mask bitmap