diff options
author | DoKM <mcazzyman@gmail.com> | 2021-07-21 18:47:21 +0200 |
---|---|---|
committer | DoKM <mcazzyman@gmail.com> | 2021-07-21 18:47:21 +0200 |
commit | c838098130bbe868c9b693c8a535b46585e2943d (patch) | |
tree | 2aac6270526cb48495c1c2590f4f02a40ee69dfb /src | |
parent | c8855f07f6063fa870a8fdd8a3db2bb882a6fe8c (diff) | |
download | NotEnoughUpdates-c838098130bbe868c9b693c8a535b46585e2943d.tar.gz NotEnoughUpdates-c838098130bbe868c9b693c8a535b46585e2943d.tar.bz2 NotEnoughUpdates-c838098130bbe868c9b693c8a535b46585e2943d.zip |
hot fix for crashing in pv
due to me forgetting to check if backpack info is null
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java index b28e290c..b4fce512 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java @@ -835,9 +835,20 @@ public class ProfileViewer { return inventoryInfo;
}
+ public boolean checkIfValidJson(JsonElement element){
+ return element != null;
+ }
+
public JsonObject getBackpackData(JsonObject backpack_contents_json, JsonObject backpack_icons) {
JsonArray contents = new JsonArray();
+ if(!(checkIfValidJson(backpack_contents_json) && checkIfValidJson(backpack_icons))){
+ JsonObject bundledReturn = new JsonObject();
+ bundledReturn.add("contents", new JsonArray());
+ bundledReturn.add("backpack_sizes", new JsonArray());
+
+ return bundledReturn;
+ }
String[] backpackArray = new String[0];
|