From 1b8dc1f75e5e9919b5f6fa4840eb84f6484e474a Mon Sep 17 00:00:00 2001 From: huanghongxun Date: Sat, 18 Dec 2021 01:40:10 +0800 Subject: [PATCH] fix(mcbbs): NPE when fileApi is not empty. Closes #1197. --- .../jackhuang/hmcl/mod/mcbbs/McbbsModpackCompletionTask.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/mcbbs/McbbsModpackCompletionTask.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/mcbbs/McbbsModpackCompletionTask.java index d5523620f..c9294d56e 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/mcbbs/McbbsModpackCompletionTask.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/mcbbs/McbbsModpackCompletionTask.java @@ -62,7 +62,6 @@ public class McbbsModpackCompletionTask extends CompletableFutureTask { private final String version; private final File configurationFile; private ModpackConfiguration configuration; - private GetTask dependent; private McbbsModpackManifest manifest; private final List> dependencies = new LinkedList<>(); @@ -108,11 +107,11 @@ public class McbbsModpackCompletionTask extends CompletableFutureTask { } })).thenComposeAsync(wrap(unused1 -> { return executor.one(new GetTask(new URL(manifest.getFileApi() + "/manifest.json"))); - })).thenComposeAsync(wrap(unused1 -> { + })).thenComposeAsync(wrap(remoteManifestJson -> { McbbsModpackManifest remoteManifest; // We needs to update modpack from online server. try { - remoteManifest = JsonUtils.fromNonNullJson(dependent.getResult(), McbbsModpackManifest.class); + remoteManifest = JsonUtils.fromNonNullJson(remoteManifestJson, McbbsModpackManifest.class); } catch (JsonParseException e) { throw new IOException("Unable to parse server manifest.json from " + manifest.getFileApi(), e); }