diff --git a/core/src/io/github/lonamiwebs/klooni/Klooni.java b/core/src/io/github/lonamiwebs/klooni/Klooni.java index ee8754e..9a3df41 100644 --- a/core/src/io/github/lonamiwebs/klooni/Klooni.java +++ b/core/src/io/github/lonamiwebs/klooni/Klooni.java @@ -61,7 +61,11 @@ public class Klooni extends Game { // Use only one instance for the theme, so anyone using it uses the most up-to-date Theme.skin = skin; // Not the best idea - theme = Theme.getTheme(prefs.getString("themeName", "default")); + final String themeName = prefs.getString("themeName", "default"); + if (Theme.exists(themeName)) + theme = Theme.getTheme(themeName); + else + theme = Theme.getTheme("default"); Gdx.input.setCatchBackKey(true); // To show the pause menu setScreen(new MainMenuScreen(this)); diff --git a/core/src/io/github/lonamiwebs/klooni/Theme.java b/core/src/io/github/lonamiwebs/klooni/Theme.java index ebcc53e..4cb6b57 100644 --- a/core/src/io/github/lonamiwebs/klooni/Theme.java +++ b/core/src/io/github/lonamiwebs/klooni/Theme.java @@ -52,6 +52,10 @@ public class Theme { //region Static methods + public static boolean exists(final String name) { + return Gdx.files.internal("themes/"+name+".theme").exists(); + } + // Gets all the available themes on the available on the internal game storage public static Theme[] getThemes() { FileHandle[] handles = Gdx.files.internal("themes").list();