Skip to content

Commit 66ed87e

Browse files
authored
修复 cslApi 为 null 时启动器崩溃的问题 (#3762)
1 parent 27ffc8e commit 66ed87e

File tree

1 file changed

+4
-1
lines changed
  • HMCLCore/src/main/java/org/jackhuang/hmcl/auth/offline

1 file changed

+4
-1
lines changed

HMCLCore/src/main/java/org/jackhuang/hmcl/auth/offline/Skin.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import org.jackhuang.hmcl.task.FetchTask;
2424
import org.jackhuang.hmcl.task.GetTask;
2525
import org.jackhuang.hmcl.task.Task;
26+
import org.jackhuang.hmcl.util.Lang;
2627
import org.jackhuang.hmcl.util.StringUtils;
2728
import org.jackhuang.hmcl.util.gson.JsonUtils;
2829
import org.jackhuang.hmcl.util.io.FileUtils;
@@ -165,7 +166,9 @@ public Task<LoadedSkin> load(String username) {
165166
});
166167
case LITTLE_SKIN:
167168
case CUSTOM_SKIN_LOADER_API:
168-
String realCslApi = type == Type.LITTLE_SKIN ? "https://littleskin.cn" : StringUtils.removeSuffix(cslApi, "/");
169+
String realCslApi = type == Type.LITTLE_SKIN
170+
? "https://littleskin.cn"
171+
: StringUtils.removeSuffix(Lang.requireNonNullElse(cslApi, ""), "/");
169172
return Task.composeAsync(() -> new GetTask(new URL(String.format("%s/%s.json", realCslApi, username))))
170173
.thenComposeAsync(json -> {
171174
SkinJson result = JsonUtils.GSON.fromJson(json, SkinJson.class);

0 commit comments

Comments
 (0)