From e5cca247400feba126e824894cf55f2c69bf3c9c Mon Sep 17 00:00:00 2001 From: huanghongxun Date: Sat, 31 Jul 2021 02:01:17 +0800 Subject: [PATCH] fix: Version.jar becomes wrong value after resolvePreservingPatches --- .../main/java/org/jackhuang/hmcl/game/Version.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 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..cfa8f10f4 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/game/Version.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/game/Version.java @@ -274,10 +274,12 @@ public class Version implements Comparable, Validation { Version thisVersion; if (inheritsFrom == null) { - if (isRoot()) - thisVersion = new Version(id).setPatches(patches).setJar(id); - else - thisVersion = this.jar == null ? this.setJar(id) : this; + if (isRoot()) { + thisVersion = new Version(id).setPatches(patches); + } else { + thisVersion = this; + } + thisVersion = this.jar == null ? thisVersion.setJar(id) : thisVersion.setJar(this.jar); } else { // To maximize the compatibility. if (!resolvedSoFar.add(id)) { @@ -333,7 +335,7 @@ public class Version implements Comparable, Validation { } } - return thisVersion.setId(id); + return thisVersion.setId(id).setJar(resolve(provider).getJar()); } private Version markAsResolved() {