From e570ddbb53992db74a1fbd2bdff268e2cb699cbf Mon Sep 17 00:00:00 2001 From: LamGC Date: Sat, 6 Jun 2020 10:51:24 +0800 Subject: [PATCH] =?UTF-8?q?[Change]=20PreLoadDataComparator=20=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=AF=B9JsonElement=E6=98=AF=E5=90=A6=E4=B8=BAJsonObj?= =?UTF-8?q?ect=E7=9A=84=E6=A3=80=E6=9F=A5;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../net/lamgc/cgj/bot/sort/PreLoadDataComparator.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/lamgc/cgj/bot/sort/PreLoadDataComparator.java b/src/main/java/net/lamgc/cgj/bot/sort/PreLoadDataComparator.java index 65673aa..96e805e 100644 --- a/src/main/java/net/lamgc/cgj/bot/sort/PreLoadDataComparator.java +++ b/src/main/java/net/lamgc/cgj/bot/sort/PreLoadDataComparator.java @@ -2,7 +2,6 @@ package net.lamgc.cgj.bot.sort; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import net.lamgc.cgj.bot.BotCommandProcess; import net.lamgc.cgj.bot.cache.CacheStoreCentral; import java.io.IOException; @@ -21,6 +20,15 @@ public class PreLoadDataComparator implements Comparator { @Override public int compare(JsonElement o1, JsonElement o2) { + if(!o1.isJsonObject() || !o2.isJsonObject()) { + if(o1.isJsonObject()) { + return 1; + } else if(o2.isJsonObject()) { + return -1; + } else { + return 0; + } + } if(!o1.getAsJsonObject().has("illustId") || !o2.getAsJsonObject().has("illustId")) { if(o1.getAsJsonObject().has("illustId")) { return 1;