From 84d5e5495459eefadcf8ef38ba4c2680e464d399 Mon Sep 17 00:00:00 2001 From: FongMi Date: Sun, 21 May 2023 02:41:02 +0800 Subject: [PATCH] Update Doh.java --- catvod/src/main/java/com/github/catvod/bean/Doh.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/catvod/src/main/java/com/github/catvod/bean/Doh.java b/catvod/src/main/java/com/github/catvod/bean/Doh.java index 136c39d39..beeed14c4 100644 --- a/catvod/src/main/java/com/github/catvod/bean/Doh.java +++ b/catvod/src/main/java/com/github/catvod/bean/Doh.java @@ -36,8 +36,7 @@ public class Doh { } public static List arrayFrom(JsonElement element) { - Type listType = new TypeToken>() { - }.getType(); + Type listType = new TypeToken>() {}.getType(); List items = new Gson().fromJson(element, listType); return items == null ? new ArrayList<>() : items; } @@ -61,10 +60,9 @@ public class Doh { public List getHosts() { try { - if (getIps().isEmpty()) return null; List list = new ArrayList<>(); for (String ip : getIps()) list.add(InetAddress.getByName(ip)); - return list; + return list.isEmpty() ? null : list; } catch (Exception ignored) { return null; }