summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRay <[email protected]>2024-06-09 13:16:18 +0200
committerRay <[email protected]>2024-06-09 13:16:18 +0200
commit6b3c1148bfbcd354dc7e6c825fb1e452c6e0fbfd (patch)
tree84814884d0dca9359b725bdb8a3f4adb881168d8
parent8c712f82d12c08fd4710468d908be765ee54e748 (diff)
downloadraylib-6b3c1148bfbcd354dc7e6c825fb1e452c6e0fbfd.tar.gz
raylib-6b3c1148bfbcd354dc7e6c825fb1e452c6e0fbfd.zip
REVIEWED: Animation name being NULL #4037
-rw-r--r--src/rmodels.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/rmodels.c b/src/rmodels.c
index 57059a01..14cfc64a 100644
--- a/src/rmodels.c
+++ b/src/rmodels.c
@@ -5772,8 +5772,11 @@ static ModelAnimation *LoadModelAnimationsGLTF(const char *fileName, int *animCo
animDuration = (t > animDuration)? t : animDuration;
}
- strncpy(animations[i].name, animData.name, sizeof(animations[i].name));
- animations[i].name[sizeof(animations[i].name) - 1] = '\0';
+ if (animData.name != NULL)
+ {
+ strncpy(animations[i].name, animData.name, sizeof(animations[i].name));
+ animations[i].name[sizeof(animations[i].name) - 1] = '\0';
+ }
animations[i].frameCount = (int)(animDuration*1000.0f/GLTF_ANIMDELAY) + 1;
animations[i].framePoses = RL_MALLOC(animations[i].frameCount*sizeof(Transform *));
@@ -5823,7 +5826,7 @@ static ModelAnimation *LoadModelAnimationsGLTF(const char *fileName, int *animCo
BuildPoseFromParentJoints(animations[i].bones, animations[i].boneCount, animations[i].framePoses[j]);
}
- TRACELOG(LOG_INFO, "MODEL: [%s] Loaded animation: %s (%d frames, %fs)", fileName, animData.name, animations[i].frameCount, animDuration);
+ TRACELOG(LOG_INFO, "MODEL: [%s] Loaded animation: %s (%d frames, %fs)", fileName, (animData.name != NULL)? animData.name : "NULL", animations[i].frameCount, animDuration);
RL_FREE(boneChannels);
}
}