From 0b75a59cfe7181ec486a343d2add39118c2edbe8 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 29 Aug 2003 22:04:35 +0000 Subject: [PATCH] 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. --- src/osgPlugins/jpeg/ReaderWriterJPEG.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/osgPlugins/jpeg/ReaderWriterJPEG.cpp b/src/osgPlugins/jpeg/ReaderWriterJPEG.cpp index 3c1f22b0c..bfa51db04 100644 --- a/src/osgPlugins/jpeg/ReaderWriterJPEG.cpp +++ b/src/osgPlugins/jpeg/ReaderWriterJPEG.cpp @@ -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;