From 53d67616c30c23e27a3d772f74cbd6570eae59cb Mon Sep 17 00:00:00 2001 From: redphx <96280+redphx@users.noreply.github.com> Date: Wed, 4 Sep 2024 16:43:39 +0700 Subject: [PATCH] Fix not clearing states when quitting game while queueing --- src/index.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/index.ts b/src/index.ts index fe6dce3..6b488a5 100644 --- a/src/index.ts +++ b/src/index.ts @@ -282,10 +282,13 @@ window.addEventListener(BxEvent.DATA_CHANNEL_CREATED, e => { }); function unload() { - if (!STATES.isPlaying) { + if (!STATES.isPlaying && !Object.keys(STATES.currentStream).length) { return; } + STATES.isPlaying = false; + STATES.currentStream = {}; + // Stop MKB listeners EmulatedMkbHandler.getInstance().destroy(); NativeMkbHandler.getInstance().destroy(); @@ -293,8 +296,6 @@ function unload() { // Destroy StreamPlayer STATES.currentStream.streamPlayer?.destroy(); - STATES.isPlaying = false; - STATES.currentStream = {}; window.BX_EXPOSED.shouldShowSensorControls = false; window.BX_EXPOSED.stopTakRendering = false;