在 DownloadListPage 中添加图标缓存 (#4866)

This commit is contained in:
Glavo
2025-12-12 21:12:51 +08:00
committed by GitHub
parent 497789603a
commit 29e40ec1a5
3 changed files with 87 additions and 4 deletions

View File

@@ -20,6 +20,7 @@ package org.jackhuang.hmcl.util.io;
import org.jackhuang.hmcl.util.Pair;
import org.jackhuang.hmcl.util.StringUtils;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.io.*;
import java.net.*;
@@ -419,6 +420,15 @@ public final class NetworkUtils {
public static @NotNull URI toURI(@NotNull URL url) {
return toURI(url.toExternalForm());
}
// ====
public static @Nullable URI toURIOrNull(String uri) {
if (StringUtils.isNotBlank(uri)) {
try {
return toURI(uri);
} catch (Exception ignored) {
}
}
return null;
}
}