Skip to content

Commit

Permalink
null pointer check to protect segfault
Browse files Browse the repository at this point in the history
some animation data has meshes without bone influence, this would segfault.
  • Loading branch information
JettMonstersGoBoom committed Dec 21, 2024
1 parent 0212ed0 commit dc202e8
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/rmodels.c
Original file line number Diff line number Diff line change
Expand Up @@ -2350,6 +2350,8 @@ void UpdateModelAnimation(Model model, ModelAnimation anim, int frame)
bool updated = false; // Flag to check when anim vertex information is updated
const int vValues = mesh.vertexCount*3;

if ((mesh.boneWeights==NULL) || (mesh.boneIds==NULL)) continue; // skip if missing bone data, causes segfault without on some models

for (int vCounter = 0; vCounter < vValues; vCounter += 3)
{
mesh.animVertices[vCounter] = 0;
Expand Down

0 comments on commit dc202e8

Please sign in to comment.