Conceal NPE

This commit is contained in:
huanghongxun 2018-09-26 19:07:09 +08:00
parent 5a0e17b121
commit 48d98b2424
2 changed files with 2 additions and 4 deletions

View File

@ -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);

View File

@ -40,7 +40,6 @@ public class DefaultGameRepository implements GameRepository {
private File baseDirectory;
protected Map<String, Version> 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) {