Skip to content

Commit

Permalink
Check for nullptr before copying face indices
Browse files Browse the repository at this point in the history
  • Loading branch information
stuarthayhurst committed Sep 2, 2024
1 parent 94ac5de commit 24ec8ef
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/ammonite/models/modelLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 24ec8ef

Please sign in to comment.