diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/game/HMCLGameRepository.java b/HMCL/src/main/java/org/jackhuang/hmcl/game/HMCLGameRepository.java index 42762829b..2d21b77a6 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/game/HMCLGameRepository.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/game/HMCLGameRepository.java @@ -150,7 +150,7 @@ public class HMCLGameRepository extends DefaultGameRepository { } public Image getVersionIconImage(String id) { - if (id == null) + if (id == null || !isLoaded()) return new Image("/assets/img/grass.png"); Version version = getVersion(id); diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/game/DefaultGameRepository.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/game/DefaultGameRepository.java index 87af7f78f..1313444f5 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/game/DefaultGameRepository.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/game/DefaultGameRepository.java @@ -40,7 +40,6 @@ public class DefaultGameRepository implements GameRepository { private File baseDirectory; protected Map versions; - protected boolean loaded = false; public DefaultGameRepository(File baseDirectory) { this.baseDirectory = baseDirectory; @@ -251,7 +250,6 @@ public class DefaultGameRepository implements GameRepository { } this.versions = versions; - loaded = true; } @Override @@ -357,7 +355,7 @@ public class DefaultGameRepository implements GameRepository { } public boolean isLoaded() { - return loaded; + return versions != null; } public File getModpackConfiguration(String version) {