* Throw instead of assert on invalid file input

* Check JSON object type before accessing members
* Ensure samplers input and output references are set before accessing them
This commit is contained in:
Max Vollmer (Microsoft Havok)
2021-04-21 16:17:03 +01:00
parent 6027c10969
commit 746d5cf964
3 changed files with 31 additions and 6 deletions

View File

@@ -135,7 +135,9 @@ void SortByPTypeProcess::Execute(aiScene *pScene) {
std::vector<unsigned int>::iterator meshIdx = replaceMeshIndex.begin();
for (unsigned int i = 0; i < pScene->mNumMeshes; ++i) {
aiMesh *const mesh = pScene->mMeshes[i];
ai_assert(0 != mesh->mPrimitiveTypes);
if (mesh->mPrimitiveTypes == 0) {
throw DeadlyImportError("GLTF: Mesh with invalid primitive type: ", mesh->mName.C_Str());
}
// if there's just one primitive type in the mesh there's nothing to do for us
unsigned int num = 0;