]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/image.cpp
wchar_t byte-swapping is not necessary if __STDC_ISO_10646__ is defined.
[wxWidgets.git] / src / common / image.cpp
index 430bf440d0ce762af55b8916083e043fe7f608fa..3e54488163451e2ff2c06dd382d2f36d3f73ae35 100644 (file)
@@ -525,7 +525,10 @@ unsigned char wxImage::GetBlue( int x, int y ) const
 
 bool wxImage::Ok() const
 {
-    return (M_IMGDATA && M_IMGDATA->m_ok);
+    // image of 0 width or height can't be considered ok - at least because it
+    // causes crashes in ConvertToBitmap() if we don't catch it in time
+    wxImageRefData *data = M_IMGDATA;
+    return data && data->m_ok && data->m_width && data->m_height;
 }
 
 char unsigned *wxImage::GetData() const