From 17643172df0eec7521996b786ea3f74bae8acb43 Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Fri, 24 Jul 2020 00:36:48 -0400 Subject: Fix rare case of no last_save --- me/Danker/handlers/APIHandler.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/me/Danker/handlers/APIHandler.java b/me/Danker/handlers/APIHandler.java index 67527b3..e81b1f1 100644 --- a/me/Danker/handlers/APIHandler.java +++ b/me/Danker/handlers/APIHandler.java @@ -125,7 +125,10 @@ public class APIHandler { for (JsonElement profile : profilesArray) { JsonObject profileJSON = profile.getAsJsonObject(); - long profileLastSave = profileJSON.get("members").getAsJsonObject().get(UUID).getAsJsonObject().get("last_save").getAsLong(); + long profileLastSave = 0; + if (profileJSON.get("members").getAsJsonObject().get(UUID).getAsJsonObject().has("last_save")) { + profileLastSave = profileJSON.get("members").getAsJsonObject().get(UUID).getAsJsonObject().get("last_save").getAsLong(); + } if (profileLastSave > latestSave) { latestProfile = profileJSON.get("profile_id").getAsString(); -- cgit