From 040e71db5ba6d8c6cfaff88a1adf80a3df6287dc Mon Sep 17 00:00:00 2001 From: miku-666 <74728189+NessieHax@users.noreply.github.com> Date: Mon, 12 Aug 2024 01:19:16 +0200 Subject: [PATCH] AnimationDeserializer - Fix 'DeserializeAnimationAnim' when animString value is empty --- .../Internal/Deserializer/AnimationDeserializer.cs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/PCK-Studio/Internal/Deserializer/AnimationDeserializer.cs b/PCK-Studio/Internal/Deserializer/AnimationDeserializer.cs index 51e6e580..9a0bc124 100644 --- a/PCK-Studio/Internal/Deserializer/AnimationDeserializer.cs +++ b/PCK-Studio/Internal/Deserializer/AnimationDeserializer.cs @@ -23,8 +23,11 @@ namespace PckStudio.Internal.Deserializer { Image texture = asset.GetTexture(); IEnumerable frameTextures = texture.Split(ImageLayoutDirection.Vertical); - Animation animation = new Animation(frameTextures); - DeserializeAnimationAnim(ref animation, asset.GetProperty("ANIM")); + string animString = asset.GetProperty("ANIM"); + bool animStringIsEmpty = string.IsNullOrEmpty(animString); + Animation animation = new Animation(frameTextures, animStringIsEmpty); + if (!animStringIsEmpty) + DeserializeAnimationAnim(ref animation, animString); return animation; } return Animation.CreateEmpty(); @@ -32,11 +35,6 @@ namespace PckStudio.Internal.Deserializer private static bool DeserializeAnimationAnim(ref Animation animation, string animString) { - if (string.IsNullOrEmpty(animString)) - { - Trace.TraceError($"[{nameof(AnimationExtensions)}:{nameof(DeserializeAnimationAnim)}] Failed to parse anim. anim was null or empty."); - return false; - } animString = animString.Trim(); animation.Interpolate = animString.StartsWith("#");