From 3b190db508b1cb38ffc9c70eea2be253285d0fc5 Mon Sep 17 00:00:00 2001 From: Jacob <2606873+unitoftime@users.noreply.github.com> Date: Tue, 12 Nov 2024 11:48:15 -0500 Subject: [PATCH] Fix divide by zero --- render/anim.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/render/anim.go b/render/anim.go index f28daa4..deef83c 100644 --- a/render/anim.go +++ b/render/anim.go @@ -177,6 +177,9 @@ func (a *Animation) SetFrame(idx int) { } func (a *Animation) GetFrame() Frame { + if len(a.curAnim) <= 0 { + return Frame{} + } idx := a.frameIdx % len(a.curAnim) return a.curAnim[idx] }