diff options
| author | Charles <[email protected]> | 2023-06-10 16:15:24 -0400 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-06-10 22:15:24 +0200 |
| commit | 2e00d16f3d3808defe76d9af75df2dd714c66af2 (patch) | |
| tree | f2e65380249ebad9b28d1cd2d7010a4171272c6b /src/rmodels.c | |
| parent | 6aada7d5ecc2c201665444dddec9debc2465be8f (diff) | |
| download | raylib-2e00d16f3d3808defe76d9af75df2dd714c66af2.tar.gz raylib-2e00d16f3d3808defe76d9af75df2dd714c66af2.zip | |
GLTF: fix segfault in animNormals memcpy when mesh.normals == NULL (#3103)
Diffstat (limited to 'src/rmodels.c')
| -rw-r--r-- | src/rmodels.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/rmodels.c b/src/rmodels.c index c4073eed..23a5d16a 100644 --- a/src/rmodels.c +++ b/src/rmodels.c @@ -5201,7 +5201,9 @@ static Model LoadGLTF(const char *fileName) model.meshes[meshIndex].animVertices = RL_CALLOC(model.meshes[meshIndex].vertexCount*3, sizeof(float)); memcpy(model.meshes[meshIndex].animVertices, model.meshes[meshIndex].vertices, model.meshes[meshIndex].vertexCount*3*sizeof(float)); model.meshes[meshIndex].animNormals = RL_CALLOC(model.meshes[meshIndex].vertexCount*3, sizeof(float)); - memcpy(model.meshes[meshIndex].animNormals, model.meshes[meshIndex].normals, model.meshes[meshIndex].vertexCount*3*sizeof(float)); + if (model.meshes[meshIndex].normals != NULL) { + memcpy(model.meshes[meshIndex].animNormals, model.meshes[meshIndex].normals, model.meshes[meshIndex].vertexCount*3*sizeof(float)); + } meshIndex++; // Move to next mesh } |
