diff --git a/src/pocketmine/utils/TextFormat.php b/src/pocketmine/utils/TextFormat.php index 08cd5aa6f..6d106db1c 100644 --- a/src/pocketmine/utils/TextFormat.php +++ b/src/pocketmine/utils/TextFormat.php @@ -288,7 +288,11 @@ abstract class TextFormat{ } } - return json_encode($newString, JSON_UNESCAPED_SLASHES); + $result = json_encode($newString, JSON_UNESCAPED_SLASHES); + if($result === false){ + throw new \InvalidArgumentException("Failed to encode result JSON: " . json_last_error_msg()); + } + return $result; } /**