mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-05 11:27:07 +00:00
Skin: Correctly handle errors produced by commented JSON decoder
This commit is contained in:
parent
8fb7fff6b9
commit
c9626c610b
@ -28,7 +28,6 @@ use pocketmine\utils\Limits;
|
||||
use function implode;
|
||||
use function in_array;
|
||||
use function json_encode;
|
||||
use function json_last_error_msg;
|
||||
use function strlen;
|
||||
use const JSON_THROW_ON_ERROR;
|
||||
|
||||
@ -68,9 +67,10 @@ final class Skin{
|
||||
}
|
||||
|
||||
if($geometryData !== ""){
|
||||
$decodedGeometry = (new CommentedJsonDecoder())->decode($geometryData);
|
||||
if($decodedGeometry === false){
|
||||
throw new InvalidSkinException("Invalid geometry data (" . json_last_error_msg() . ")");
|
||||
try{
|
||||
$decodedGeometry = (new CommentedJsonDecoder())->decode($geometryData);
|
||||
}catch(\RuntimeException $e){
|
||||
throw new InvalidSkinException("Invalid geometry data: " . $e->getMessage(), 0, $e);
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
x
Reference in New Issue
Block a user