diff options
| author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2022-10-01 20:00:38 +0200 |
|---|---|---|
| committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2022-10-01 20:00:38 +0200 |
| commit | 199fccd3da24cf470f647f93d007dd4303107e19 (patch) | |
| tree | 7b0af81257ce31b018279fa6643779f468ef64c0 /src/main/java | |
| parent | 9c8b7d4fbb4a34f501f609e59307033feef2b75e (diff) | |
| download | NotEnoughUpdates-199fccd3da24cf470f647f93d007dd4303107e19.tar.gz NotEnoughUpdates-199fccd3da24cf470f647f93d007dd4303107e19.tar.bz2 NotEnoughUpdates-199fccd3da24cf470f647f93d007dd4303107e19.zip | |
fixed npe
Diffstat (limited to 'src/main/java')
| -rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/util/HotmInformation.java | 8 |
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(); |
