aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorDoKM <mcazzyman@gmail.com>2021-07-21 18:47:21 +0200
committerDoKM <mcazzyman@gmail.com>2021-07-21 18:47:21 +0200
commitc838098130bbe868c9b693c8a535b46585e2943d (patch)
tree2aac6270526cb48495c1c2590f4f02a40ee69dfb /src/main/java
parentc8855f07f6063fa870a8fdd8a3db2bb882a6fe8c (diff)
downloadNotEnoughUpdates-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/main/java')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java11
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];