Added an explicit check for file extension so that only .jpg and .jpeg files

are loaded with the JPEG plugin, thus avoid a crash which was occuring when
it was passed non JPEG files.
This commit is contained in:
Robert Osfield 2003-08-29 22:04:35 +00:00
parent 8498422d7e
commit 0b75a59cfe

View File

@ -281,6 +281,8 @@ class ReaderWriterJPEG : public osgDB::ReaderWriter
virtual ReadResult readImage(const std::string& fileName, const osgDB::ReaderWriter::Options*)
{
std::string ext = osgDB::getFileExtension(fileName);
if (!acceptsExtension(ext)) return ReadResult::FILE_NOT_HANDLED;
unsigned char *imageData = NULL;
int width_ret;