From 199fccd3da24cf470f647f93d007dd4303107e19 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sat, 1 Oct 2022 20:00:38 +0200 Subject: fixed npe --- .../github/moulberry/notenoughupdates/util/HotmInformation.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/HotmInformation.java b/src/main/java/io/github/moulberry/notenoughupdates/util/HotmInformation.java index 3b84c4f9..57c4ae3b 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/util/HotmInformation.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/util/HotmInformation.java @@ -169,9 +169,11 @@ public class HotmInformation { } @SubscribeEvent public void onApiDataLoaded(ProfileDataLoadedEvent event) { - JsonObject entireApiResponse = event.getData(); - if (!entireApiResponse.has("success") || !entireApiResponse.get("success").getAsBoolean()) return; - JsonArray profiles = entireApiResponse.getAsJsonArray("profiles"); + JsonObject data = event.getData(); + if (data == null) return; + + if (!data.has("success") || !data.get("success").getAsBoolean()) return; + JsonArray profiles = data.getAsJsonArray("profiles"); for (JsonElement element : profiles) { JsonObject profile = element.getAsJsonObject(); String profileName = profile.get("cute_name").getAsString(); -- cgit