Skip to content

Commit

Permalink
fix ForwardMsgAdapter
Browse files Browse the repository at this point in the history
  • Loading branch information
guimc233 committed Jan 27, 2024
1 parent f2b6901 commit 605ff66
Showing 1 changed file with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,12 @@ public class ForwardMsgAdapter implements JsonDeserializer<ForwardMsgResp> {
public ForwardMsgResp deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) {
List<ForwardMsgResp.Node> nodes = new ArrayList<>();
JsonObject jsonObj = json.getAsJsonObject();
JsonArray messagesArray;
try {
messagesArray = jsonObj.get("messages").getAsJsonArray();
} catch (NullPointerException ignored) {
messagesArray = jsonObj.get("message").getAsJsonArray();
JsonElement messagesArray;
messagesArray = jsonObj.get("messages");
if (messagesArray == null) {
messagesArray = jsonObj.get("message");
}
for (JsonElement jsonElement : messagesArray) {
for (JsonElement jsonElement : messagesArray.getAsJsonArray()) {
JsonsObject obj = new JsonsObject(jsonElement.getAsJsonObject());
int time = obj.optInt("time");
String messageType = obj.optString("message_type");
Expand Down

0 comments on commit 605ff66

Please sign in to comment.