null pointer check to protect segfault

some animation data has meshes without bone influence, this would segfault.
This commit is contained in:
Jett 2024-12-21 08:04:28 -05:00
parent 0212ed0a4b
commit dc202e8aef

View File

@ -2350,6 +2350,8 @@ void UpdateModelAnimation(Model model, ModelAnimation anim, int frame)
bool updated = false; // Flag to check when anim vertex information is updated bool updated = false; // Flag to check when anim vertex information is updated
const int vValues = mesh.vertexCount*3; 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) for (int vCounter = 0; vCounter < vValues; vCounter += 3)
{ {
mesh.animVertices[vCounter] = 0; mesh.animVertices[vCounter] = 0;