From 7c5f45c6740243825f6d94b77542a5d119543ac7 Mon Sep 17 00:00:00 2001 From: Stuart Hayhurst Date: Mon, 2 Sep 2024 19:45:19 +0100 Subject: [PATCH] Check for nullptr before copying face indices --- src/ammonite/models/modelLoader.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ammonite/models/modelLoader.cpp b/src/ammonite/models/modelLoader.cpp index 462e2c1..ba7c483 100644 --- a/src/ammonite/models/modelLoader.cpp +++ b/src/ammonite/models/modelLoader.cpp @@ -63,8 +63,10 @@ namespace ammonite { int index = 0; for (unsigned int i = 0; i < meshPtr->mNumFaces; i++) { aiFace face = meshPtr->mFaces[i]; - std::memcpy(&newMesh->indices[index], &face.mIndices[0], - face.mNumIndices * sizeof(unsigned int)); + if (&face.mIndices[0] != nullptr) { + std::memcpy(&newMesh->indices[index], &face.mIndices[0], + face.mNumIndices * sizeof(unsigned int)); + } index += face.mNumIndices; }