mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 18:32:55 +00:00
Player: Throw exception on failure to encode form JSON
This commit is contained in:
@ -3365,6 +3365,9 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
$pk = new ModalFormRequestPacket();
|
||||
$pk->formId = $id;
|
||||
$pk->formData = json_encode($form);
|
||||
if($pk->formData === false){
|
||||
throw new \InvalidArgumentException("Failed to encode form JSON: " . json_last_error_msg());
|
||||
}
|
||||
if($this->dataPacket($pk)){
|
||||
$this->forms[$id] = $form;
|
||||
}
|
||||
|
Reference in New Issue
Block a user