X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d7c429142df39ccb1e8a4f68c4e2bb0ab7c2083a..9ac71bef070f553f4ecef2c549dba33b10422f06:/src/common/imagjpeg.cpp diff --git a/src/common/imagjpeg.cpp b/src/common/imagjpeg.cpp index 23c5e7aa36..c2525bae43 100644 --- a/src/common/imagjpeg.cpp +++ b/src/common/imagjpeg.cpp @@ -378,9 +378,10 @@ bool wxJPEGHandler::DoCanRead( wxInputStream& stream ) { unsigned char hdr[2]; - stream.Read(hdr, 2); - stream.SeekI(-2, wxFromCurrent); - return (hdr[0] == 0xFF && hdr[1] == 0xD8); + if ( !stream.Read(hdr, WXSIZEOF(hdr)) ) + return FALSE; + + return hdr[0] == 0xFF && hdr[1] == 0xD8; } #endif // wxUSE_STREAMS