diff --git a/source/funkin/system/MusicBeatSubstate.hx b/source/funkin/system/MusicBeatSubstate.hx index ad0786ef..96bf6fdc 100644 --- a/source/funkin/system/MusicBeatSubstate.hx +++ b/source/funkin/system/MusicBeatSubstate.hx @@ -222,7 +222,8 @@ class MusicBeatSubstate extends FlxSubState implements IBeatReceiver public override function destroy() { super.destroy(); call("onDestroy"); - stateScript.destroy(); + if(stateScript != null) + stateScript.destroy(); } public override function switchTo(nextState:FlxState) {