From 7ec91e908c721ed198bb8568d5757ff8de43a33f Mon Sep 17 00:00:00 2001 From: NeeEoo Date: Sat, 14 Oct 2023 14:34:26 +0200 Subject: [PATCH] heck --- source/funkin/backend/MusicBeatState.hx | 3 +-- source/funkin/backend/MusicBeatSubstate.hx | 7 +++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/source/funkin/backend/MusicBeatState.hx b/source/funkin/backend/MusicBeatState.hx index 791007f4..fc89b4d5 100644 --- a/source/funkin/backend/MusicBeatState.hx +++ b/source/funkin/backend/MusicBeatState.hx @@ -171,8 +171,7 @@ class MusicBeatState extends FlxState implements IBeatReceiver // calls the function on the assigned script if(stateScripts != null) return stateScripts.call(name, args); - else - return null; + return null; } public function event(name:String, event:T):T { diff --git a/source/funkin/backend/MusicBeatSubstate.hx b/source/funkin/backend/MusicBeatSubstate.hx index 5db43fce..3d1ad3fc 100644 --- a/source/funkin/backend/MusicBeatSubstate.hx +++ b/source/funkin/backend/MusicBeatSubstate.hx @@ -159,11 +159,14 @@ class MusicBeatSubstate extends FlxSubState implements IBeatReceiver } public function call(name:String, ?args:Array, ?defaultVal:Dynamic):Dynamic { // calls the function on the assigned script - return stateScripts.call(name, args); + if(stateScripts != null) + return stateScripts.call(name, args); + return null; } public function event(name:String, event:T):T { - stateScripts.call(name, [event]); + if(stateScripts != null) + stateScripts.call(name, [event]); return event; }