aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/HotmInformation.java8
1 files 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();