[3ds] Fix assertion failure when file could not be opened
Check result of IOSystem::Open before constructing stream. Partially addresses #3888.
This commit is contained in:
@@ -143,7 +143,13 @@ void Discreet3DSImporter::SetupProperties(const Importer * /*pImp*/) {
|
||||
// Imports the given file into the given scene structure.
|
||||
void Discreet3DSImporter::InternReadFile(const std::string &pFile,
|
||||
aiScene *pScene, IOSystem *pIOHandler) {
|
||||
StreamReaderLE theStream(pIOHandler->Open(pFile, "rb"));
|
||||
|
||||
auto theFile = pIOHandler->Open(pFile, "rb");
|
||||
if (!theFile) {
|
||||
throw DeadlyImportError("3DS: Could not open ", pFile);
|
||||
}
|
||||
|
||||
StreamReaderLE theStream(theFile);
|
||||
|
||||
// We should have at least one chunk
|
||||
if (theStream.GetRemainingSize() < 16) {
|
||||
|
||||
Reference in New Issue
Block a user