diff --git a/MinecraftClient/Json.cs b/MinecraftClient/Json.cs index c16ca4ea..827a23f4 100644 --- a/MinecraftClient/Json.cs +++ b/MinecraftClient/Json.cs @@ -16,8 +16,10 @@ public static class Json /// /// Parse a JSON string into a mutable DOM. + /// Returns null for null, empty, or whitespace-only input. /// - public static JsonNode? ParseJson(string json) => JsonNode.Parse(json); + public static JsonNode? ParseJson(string? json) => + string.IsNullOrWhiteSpace(json) ? null : JsonNode.Parse(json); /// /// Escape a string for embedding inside a JSON string literal.