mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-07 04:17: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 implode;
|
||||||
use function in_array;
|
use function in_array;
|
||||||
use function json_encode;
|
use function json_encode;
|
||||||
use function json_last_error_msg;
|
|
||||||
use function strlen;
|
use function strlen;
|
||||||
use const JSON_THROW_ON_ERROR;
|
use const JSON_THROW_ON_ERROR;
|
||||||
|
|
||||||
@ -68,9 +67,10 @@ final class Skin{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if($geometryData !== ""){
|
if($geometryData !== ""){
|
||||||
|
try{
|
||||||
$decodedGeometry = (new CommentedJsonDecoder())->decode($geometryData);
|
$decodedGeometry = (new CommentedJsonDecoder())->decode($geometryData);
|
||||||
if($decodedGeometry === false){
|
}catch(\RuntimeException $e){
|
||||||
throw new InvalidSkinException("Invalid geometry data (" . json_last_error_msg() . ")");
|
throw new InvalidSkinException("Invalid geometry data: " . $e->getMessage(), 0, $e);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user