diff --git a/Sources/GateEngine/ECS/2D Specific/Sprite/SpriteComponent.swift b/Sources/GateEngine/ECS/2D Specific/Sprite/SpriteComponent.swift index c867c395..de222be8 100644 --- a/Sources/GateEngine/ECS/2D Specific/Sprite/SpriteComponent.swift +++ b/Sources/GateEngine/ECS/2D Specific/Sprite/SpriteComponent.swift @@ -49,7 +49,7 @@ public final class SpriteComponent: Component { internal var moveToNextAnimationIfNeeded: Bool = false public var activeAnimation: SpriteAnimation? { get { - if let index = self.activeAnimationIndex { + if let index = self.activeAnimationIndex, self.animations.count > index { return self.animations[index] } return nil