From 8c1e028b46721fb2dfb953a97d13d32a3298dec9 Mon Sep 17 00:00:00 2001 From: seker <04070628@163.com> Date: Tue, 31 Dec 2024 03:42:18 +0800 Subject: [PATCH] Fix : null pointer crash (#8326) --- NEW_RELEASE_NOTES.md | 1 + libs/gltfio/src/Animator.cpp | 3 +++ 2 files changed, 4 insertions(+) diff --git a/NEW_RELEASE_NOTES.md b/NEW_RELEASE_NOTES.md index 4a1a9c7fa7e4..ee533ab0189a 100644 --- a/NEW_RELEASE_NOTES.md +++ b/NEW_RELEASE_NOTES.md @@ -7,3 +7,4 @@ for next branch cut* header. appropriate header in [RELEASE_NOTES.md](./RELEASE_NOTES.md). ## Release notes for next branch cut +fix crash: the 'target_node' of Animation Channel may be nullpointer. \ No newline at end of file diff --git a/libs/gltfio/src/Animator.cpp b/libs/gltfio/src/Animator.cpp index 0d8b667644b1..7b1bd6eb2508 100644 --- a/libs/gltfio/src/Animator.cpp +++ b/libs/gltfio/src/Animator.cpp @@ -408,6 +408,9 @@ void AnimatorImpl::addChannels(const FixedCapacityVector& nodeMap, const Sampler* samplers = dst.samplers.data(); for (cgltf_size j = 0, nchans = srcAnim.channels_count; j < nchans; ++j) { const cgltf_animation_channel& srcChannel = srcChannels[j]; + if (!srcChannel.target_node) { + continue; + } Entity targetEntity = nodeMap[srcChannel.target_node - nodes]; if (UTILS_UNLIKELY(!targetEntity)) { if (GLTFIO_VERBOSE) {