Skip to content

Commit

Permalink
Fixed NullPointerException when only hidden version here
Browse files Browse the repository at this point in the history
  • Loading branch information
huanghongxun committed Mar 1, 2016
1 parent 3ba75d2 commit 5dc8120
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.jackhuang.hellominecraft.launcher.api.PluginManager;
import org.jackhuang.hellominecraft.launcher.core.MCUtils;
import org.jackhuang.hellominecraft.launcher.core.service.IMinecraftService;
import org.jackhuang.hellominecraft.launcher.core.version.MinecraftVersion;
import org.jackhuang.hellominecraft.util.system.IOUtils;
import org.jackhuang.hellominecraft.util.StrUtils;
import org.jackhuang.hellominecraft.util.EventHandler;
Expand Down Expand Up @@ -87,8 +88,9 @@ public String getSettingsSelectedMinecraftVersion() {
public String getSelectedVersion() {
String v = selectedMinecraftVersion;
if (StrUtils.isBlank(v) || service().version().getVersionById(v) == null || service().version().getVersionById(v).hidden) {
if (service().version().getVersionCount() > 0)
v = service().version().getOneVersion(t -> !t.hidden).id;
MinecraftVersion mv = service().version().getOneVersion(t -> !t.hidden);
if (mv != null)
v = mv.id;
if (StrUtils.isNotBlank(v))
setSelectedMinecraftVersion(v);
}
Expand Down

0 comments on commit 5dc8120

Please sign in to comment.