X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/942285dcfa083d114cf519d15099ce204b9895e8..25db1b74f1264c27bbf2e5fcc9f3a19ccc56d5fc:/src/common/xpmdecod.cpp diff --git a/src/common/xpmdecod.cpp b/src/common/xpmdecod.cpp index a0d99a11db..434e8dedf9 100644 --- a/src/common/xpmdecod.cpp +++ b/src/common/xpmdecod.cpp @@ -137,7 +137,7 @@ wxImage wxXPMDecoder::ReadFile(wxInputStream& stream) size_t i; if ( stream.Read(xpm_buffer, length).LastError() == wxSTREAM_READ_ERROR ) - return FALSE; + return wxNullImage; /* * Remove comments from the file: @@ -203,6 +203,12 @@ wxImage wxXPMDecoder::ReadFile(wxInputStream& stream) lines_cnt++; } + if ( !lines_cnt ) + { + // this doesn't really look an XPM image + return wxNullImage; + } + xpm_lines = new const char*[lines_cnt]; xpm_lines[0] = xpm_buffer; line = 1;