From 0803e5e6f3fb210c7e0bb035b611eb595e70cabf Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Mon, 18 Jan 2021 20:25:33 +0100 Subject: [PATCH 1/2] Fix nullptr dereference in scenepreprocessor --- code/Common/ScenePreprocessor.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/code/Common/ScenePreprocessor.cpp b/code/Common/ScenePreprocessor.cpp index 2b73d9452..31d0ab75f 100644 --- a/code/Common/ScenePreprocessor.cpp +++ b/code/Common/ScenePreprocessor.cpp @@ -4,7 +4,6 @@ Open Asset Import Library (assimp) Copyright (c) 2006-2020, assimp team - All rights reserved. Redistribution and use of this software in source and binary forms, @@ -52,8 +51,12 @@ void ScenePreprocessor::ProcessScene() { ai_assert(scene != nullptr); // Process all meshes - for (unsigned int i = 0; i < scene->mNumMeshes; ++i) + for (unsigned int i = 0; i < scene->mNumMeshes; ++i) { + if (nullptr == scene->mMeshes[i] { + continue; + } ProcessMesh(scene->mMeshes[i]); + } // - nothing to do for nodes for the moment // - nothing to do for textures for the moment @@ -61,8 +64,12 @@ void ScenePreprocessor::ProcessScene() { // - nothing to do for cameras for the moment // Process all animations - for (unsigned int i = 0; i < scene->mNumAnimations; ++i) + for (unsigned int i = 0; i < scene->mNumAnimations; ++i) { + if (nullptr == scene->mAnimations[i]) { + continue; + } ProcessAnimation(scene->mAnimations[i]); + } // Generate a default material if none was specified if (!scene->mNumMaterials && scene->mNumMeshes) { From f24c04292506325fe3aba355d350d5f58812622e Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Mon, 18 Jan 2021 20:28:38 +0100 Subject: [PATCH 2/2] Fix typo --- code/Common/ScenePreprocessor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/Common/ScenePreprocessor.cpp b/code/Common/ScenePreprocessor.cpp index 31d0ab75f..113ca7ff1 100644 --- a/code/Common/ScenePreprocessor.cpp +++ b/code/Common/ScenePreprocessor.cpp @@ -52,7 +52,7 @@ void ScenePreprocessor::ProcessScene() { // Process all meshes for (unsigned int i = 0; i < scene->mNumMeshes; ++i) { - if (nullptr == scene->mMeshes[i] { + if (nullptr == scene->mMeshes[i]) { continue; } ProcessMesh(scene->mMeshes[i]);