From 35bbbcb484d3d210c5bee49372ce91f71a9ac215 Mon Sep 17 00:00:00 2001 From: Dakurei Date: Sat, 13 Jul 2024 20:31:49 +0200 Subject: [PATCH] Adds a check to the bgm-bar display to prevent it from being displayed in case of an empty value (#3007) --- src/ui/bgm-bar.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/ui/bgm-bar.ts b/src/ui/bgm-bar.ts index db19988a975..076eec26a8e 100644 --- a/src/ui/bgm-bar.ts +++ b/src/ui/bgm-bar.ts @@ -62,6 +62,16 @@ export default class BgmBar extends Phaser.GameObjects.Container { @param {boolean} visible Whether to show or hide the BGM bar. */ public toggleBgmBar(visible: boolean): void { + /* + Prevents the bar from being displayed if musicText is completely empty. + This can be the case, for example, when the game's 1st music track takes a long time to reach the client, + and the menu is opened before it is played. + */ + if (this.musicText.text === "") { + this.setVisible(false); + return; + } + if (!(this.scene as BattleScene).showBgmBar) { this.setVisible(false); return;