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 3, 2024
1 parent a199eac commit 7c5f45c
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 7c5f45c

Please sign in to comment.