[cob] Fix assertion failure when file could not be opened.
Check result of IOSystem::Open before constructing stream. Partially addresses #3888.pull/3890/head
parent
116ebf6e10
commit
7f13387487
|
@ -137,7 +137,13 @@ void COBImporter::SetupProperties(const Importer * /*pImp*/) {
|
|||
// Imports the given file into the given scene structure.
|
||||
void COBImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSystem *pIOHandler) {
|
||||
COB::Scene scene;
|
||||
std::unique_ptr<StreamReaderLE> stream(new StreamReaderLE(pIOHandler->Open(pFile, "rb")));
|
||||
|
||||
auto file = pIOHandler->Open(pFile, "rb");
|
||||
if (!file) {
|
||||
ThrowException("Could not open " + pFile);
|
||||
}
|
||||
|
||||
std::unique_ptr<StreamReaderLE> stream(new StreamReaderLE(file));
|
||||
|
||||
// check header
|
||||
char head[32];
|
||||
|
|
Loading…
Reference in New Issue