mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 00:33:59 +00:00
TextFormat: account for failure to encode JSON in toJSON()
This commit is contained in:
parent
41d7b8c0e4
commit
d246933e3e
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user