Fix #5862: 修复 CurseForge Addon Logo 中不包含 thumbnailUrl 时无法加载图标的问题 (#5971)

This commit is contained in:
Glavo authored and GitHub committed 2026-04-19 22:20:04 +08:00
1 parent 73e5909a69
commit 6ccc7df998
1 file changed
+8 -1
@@ -24,6 +24,7 @@ import org.jackhuang.hmcl.mod.RemoteModRepository;
import org.jackhuang.hmcl.util.Immutable;
import org.jackhuang.hmcl.util.Lang;
import org.jackhuang.hmcl.util.Pair;
import org.jackhuang.hmcl.util.StringUtils;
import org.jetbrains.annotations.Nullable;
import java.io.IOException;
@@ -211,7 +212,13 @@ public class CurseAddon implements RemoteMod.IMod {
}
public RemoteMod toMod() {
String iconUrl = Optional.ofNullable(logo).map(Logo::getThumbnailUrl).orElse("");
String iconUrl = "";
if (logo != null) {
if (StringUtils.isNotBlank(logo.getThumbnailUrl()))
iconUrl = logo.getThumbnailUrl();
else if (StringUtils.isNotBlank(logo.getUrl()))
iconUrl = logo.getUrl();
}
return new RemoteMod(
slug,