Fixed conditional statement to ensure robustness in live environments to avoid potential issues in production

This commit is contained in:
Adrian 2024-08-12 12:59:23 -04:00
parent 848cc1d23f
commit 61b40ac972

View File

@ -83,7 +83,7 @@ export abstract class ModalUiHandler extends UiHandler {
show(args: any[]): boolean {
if (args.length >= 1 && "buttonActions" in args[0]) {
super.show(args);
if ("fadeOut" in args[0]) {
if (args[0].hasOwnProperty("fadeOut") && typeof args[0].fadeOut === "function") {
const overlay = this.scene.add.rectangle((( (this.getWidth() + (this.getMargin()[0] - this.getMargin()[3]))) / 2), ((this.getHeight() + (this.getMargin()[1] - this.getMargin()[2])) / 2),this.scene.game.canvas.width ,this.scene.game.canvas.height , 0);
overlay.setName("rect-ui-overlay-modal");
overlay.setAlpha(0);