From f942dcab8b7ec7a2def48b5b21603146f160e520 Mon Sep 17 00:00:00 2001 From: miku-666 <74728189+NessieHax@users.noreply.github.com> Date: Sun, 7 May 2023 13:54:52 +0200 Subject: [PATCH] Animation.cs - Fixed anim containing empty entry at the end of the string --- PCK-Studio/Forms/Editor/Animation.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/PCK-Studio/Forms/Editor/Animation.cs b/PCK-Studio/Forms/Editor/Animation.cs index 66f25134..b302f677 100644 --- a/PCK-Studio/Forms/Editor/Animation.cs +++ b/PCK-Studio/Forms/Editor/Animation.cs @@ -51,11 +51,12 @@ namespace PckStudio.Forms.Editor } } - private void ParseAnim(string ANIM) + private void ParseAnim(string anim) { - _ = ANIM ?? throw new ArgumentNullException(nameof(ANIM)); - ANIM = (Interpolate = ANIM.StartsWith("#")) ? ANIM.Substring(1) : ANIM; - string[] animData = ANIM.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); + _ = anim ?? throw new ArgumentNullException(nameof(anim)); + anim = anim.Trim(); + anim = (Interpolate = anim.StartsWith("#")) ? anim.Substring(1) : anim; + string[] animData = anim.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); int lastFrameTime = MinimumFrameTime; if (animData.Length <= 0) for (int i = 0; i < TextureCount; i++)