mirror of
https://github.com/LamGC/ContentGrabbingJi.git
synced 2025-04-30 06:37:36 +00:00
[Change] PreLoadDataComparator 增加对JsonElement是否为JsonObject的检查;
This commit is contained in:
parent
223d78dbd6
commit
e570ddbb53
@ -2,7 +2,6 @@ package net.lamgc.cgj.bot.sort;
|
|||||||
|
|
||||||
import com.google.gson.JsonElement;
|
import com.google.gson.JsonElement;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
import net.lamgc.cgj.bot.BotCommandProcess;
|
|
||||||
import net.lamgc.cgj.bot.cache.CacheStoreCentral;
|
import net.lamgc.cgj.bot.cache.CacheStoreCentral;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -21,6 +20,15 @@ public class PreLoadDataComparator implements Comparator<JsonElement> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compare(JsonElement o1, JsonElement o2) {
|
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") || !o2.getAsJsonObject().has("illustId")) {
|
||||||
if(o1.getAsJsonObject().has("illustId")) {
|
if(o1.getAsJsonObject().has("illustId")) {
|
||||||
return 1;
|
return 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user