X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/38d4b1e4bc01ea5c58ee8e22c924408d94aa2e9e..6270539bcf24f2ec32150a09f8aad383f5de0671:/src/common/image.cpp diff --git a/src/common/image.cpp b/src/common/image.cpp index c888353fd9..e967b8ece9 100644 --- a/src/common/image.cpp +++ b/src/common/image.cpp @@ -1554,7 +1554,13 @@ bool wxImage::LoadFile( wxInputStream& stream, long type, int index ) return false; } - return handler->LoadFile(this, stream, true/*verbose*/, index); + if (!handler->CanRead(stream)) + { + wxLogError(_("Image file is not of type %d."), type); + return false; + } + else + return handler->LoadFile(this, stream, true/*verbose*/, index); } bool wxImage::LoadFile( wxInputStream& stream, const wxString& mimetype, int index ) @@ -1572,7 +1578,13 @@ bool wxImage::LoadFile( wxInputStream& stream, const wxString& mimetype, int ind return false; } - return handler->LoadFile( this, stream, true/*verbose*/, index ); + if (!handler->CanRead(stream)) + { + wxLogError(_("Image file is not of type %s."), (const wxChar*) mimetype); + return false; + } + else + return handler->LoadFile( this, stream, true/*verbose*/, index ); } bool wxImage::SaveFile( wxOutputStream& stream, int type ) const