From 07b493afd2e5aa7b881d4e72d4e602e9a8a4a0bd Mon Sep 17 00:00:00 2001 From: Nick Fisher Date: Fri, 16 Dec 2022 00:12:54 +0800 Subject: [PATCH] add frame length check --- lib/animations/animation_builder.dart | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/animations/animation_builder.dart b/lib/animations/animation_builder.dart index 4c9a4889..bcdd9283 100644 --- a/lib/animations/animation_builder.dart +++ b/lib/animations/animation_builder.dart @@ -15,7 +15,11 @@ class Animation { final Float32List? boneTransforms; Animation(this.morphData, this.numMorphWeights, this.boneTransforms, - this.boneNames, this.meshNames, this.numFrames, this.frameLengthInMs); + this.boneNames, this.meshNames, this.numFrames, this.frameLengthInMs) { + if (morphData != null && morphData!.length != numFrames * numMorphWeights) { + throw Exception("Mismatched animation data with frame length"); + } + } Animation.from( {required List> morphData,