We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e726b91 commit 2241472Copy full SHA for 2241472
core/src/main/java/org/geysermc/geyser/util/JsonUtils.java
@@ -49,7 +49,11 @@ public static JsonObject fromJson(InputStream stream) {
49
}
50
51
public static JsonObject parseJson(String s) {
52
- return (JsonObject) new JsonParser().parse(s);
+ var output = new JsonParser().parse(s);
53
+ if (output instanceof JsonObject jsonObject) {
54
+ return jsonObject;
55
+ }
56
+ throw new IllegalArgumentException("Invalid JSON: " + s);
57
58
59
public static <T> T fromJson(InputStream stream, Type type) {
0 commit comments