Skip to content

Commit c5c22fe

Browse files
AbnormalPoofHundrec
authored andcommitted
More strict null checking for animation
1 parent 302beb2 commit c5c22fe

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

source/funkin/graphics/FunkinSprite.hx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ class FunkinSprite extends FlxAnimate
380380
*/
381381
public function hasAnimation(id:String):Bool
382382
{
383-
var animationList:Array<String> = this.animation.getNameList();
383+
var animationList:Array<String> = this.animation?.getNameList() ?? [];
384384
if (animationList.contains(id))
385385
{
386386
return true;
@@ -424,7 +424,7 @@ class FunkinSprite extends FlxAnimate
424424
*/
425425
public function getCurrentAnimation():String
426426
{
427-
return this.animation.curAnim?.name ?? '';
427+
return this.animation?.curAnim?.name ?? '';
428428
}
429429

430430
/**
@@ -461,7 +461,7 @@ class FunkinSprite extends FlxAnimate
461461
public function listAnimations():Array<String>
462462
{
463463
var frameLabels:Array<String> = getFrameLabelList();
464-
var animationList:Array<String> = this.animation.getNameList();
464+
var animationList:Array<String> = this.animation?.getNameList() ?? [];
465465

466466
return frameLabels.concat(animationList);
467467
}

0 commit comments

Comments
 (0)