From 284cebb063cfbac227fce000271f82f3f939d3a8 Mon Sep 17 00:00:00 2001 From: yugecin Date: Thu, 2 Feb 2017 01:34:37 +0100 Subject: [PATCH] fix nullptr when revalidating UI for the first time, because stuff only init in the splash screen, by moving said init call to the first subscriber of the resolution/skin changed event (displaycontainer). Basically it needs to be called before the UI gets revalidated. --- src/itdelatrisu/opsu/states/Splash.java | 3 --- src/yugecin/opsudance/core/DisplayContainer.java | 2 ++ 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/itdelatrisu/opsu/states/Splash.java b/src/itdelatrisu/opsu/states/Splash.java index a5cb0155..78e83947 100644 --- a/src/itdelatrisu/opsu/states/Splash.java +++ b/src/itdelatrisu/opsu/states/Splash.java @@ -92,9 +92,6 @@ public class Splash extends BaseOpsuState { // check if watch service newly enabled this.watchServiceChange = Options.isWatchServiceEnabled() && BeatmapWatchService.get() == null; - // load Utils class first (needed in other 'init' methods) - Utils.init(displayContainer); - // fade in logo this.logoAlpha = new AnimatedValue(MIN_SPLASH_TIME, 0f, 1f, AnimationEquation.LINEAR); GameImage.MENU_LOGO.getImage().setAlpha(0f); diff --git a/src/yugecin/opsudance/core/DisplayContainer.java b/src/yugecin/opsudance/core/DisplayContainer.java index 26186dd6..12043a67 100644 --- a/src/yugecin/opsudance/core/DisplayContainer.java +++ b/src/yugecin/opsudance/core/DisplayContainer.java @@ -20,6 +20,7 @@ package yugecin.opsudance.core; import itdelatrisu.opsu.GameData; import itdelatrisu.opsu.GameImage; import itdelatrisu.opsu.Options; +import itdelatrisu.opsu.Utils; import itdelatrisu.opsu.audio.MusicController; import itdelatrisu.opsu.beatmap.Beatmap; import itdelatrisu.opsu.downloads.DownloadList; @@ -146,6 +147,7 @@ public class DisplayContainer implements ErrorDumpable, KeyListener, MouseListen @Override public void onEvent(ResolutionOrSkinChangedEvent event) { destroyImages(); + Utils.init(DisplayContainer.this); // TODO this shouldn't be here UI.revalidate(); // TODO this shouldn't be here } });