[quick3d] Fix assertion failure when file could not be opened.

Check result of IOSystem::Open before constructing stream.

Partially addresses #3888.
pull/3890/head
Jason C 2021-05-05 17:31:50 -04:00
parent e52c297284
commit a80b3b25eb
1 changed files with 6 additions and 1 deletions

View File

@ -106,7 +106,12 @@ const aiImporterDesc *Q3DImporter::GetInfo() const {
// Imports the given file into the given scene structure.
void Q3DImporter::InternReadFile(const std::string &pFile,
aiScene *pScene, IOSystem *pIOHandler) {
StreamReaderLE stream(pIOHandler->Open(pFile, "rb"));
auto file = pIOHandler->Open(pFile, "rb");
if (!file)
throw DeadlyImportError("Quick3D: Could not open ", pFile);
StreamReaderLE stream(file);
// The header is 22 bytes large
if (stream.GetRemainingSize() < 22)