From 5de150b06e85603d6e34ee3db29ad6e285394d66 Mon Sep 17 00:00:00 2001 From: huanghongxun Date: Sun, 25 Jul 2021 01:21:08 +0800 Subject: [PATCH] fix: Version.jar should be resolved to id of self if null instead of the id of ancestor. --- .../src/main/java/org/jackhuang/hmcl/game/Version.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/game/Version.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/game/Version.java index bcc491533..7e090fb46 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/game/Version.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/game/Version.java @@ -163,7 +163,7 @@ public class Version implements Comparable, Validation { } public String getJar() { - return jar; + return jar == null ? id : jar; } public String getInheritsFrom() { @@ -275,14 +275,14 @@ public class Version implements Comparable, Validation { if (inheritsFrom == null) { if (isRoot()) - thisVersion = new Version(id).setPatches(patches).setJar(id); + thisVersion = new Version(id).setPatches(patches); else - thisVersion = this.jar == null ? this.setJar(id) : this; + thisVersion = this; } else { // To maximize the compatibility. if (!resolvedSoFar.add(id)) { Logging.LOG.log(Level.WARNING, "Found circular dependency versions: " + resolvedSoFar); - thisVersion = this.jar == null ? this.setJar(id) : this; + thisVersion = this; } else { // It is supposed to auto install an version in getVersion. thisVersion = merge(provider.getVersion(inheritsFrom).resolve(provider, resolvedSoFar), false);