mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-20 16:00:20 +00:00
SkinImage: throw on wrong data length
This commit is contained in:
parent
1171bae691
commit
dbca36e5e2
@ -34,6 +34,9 @@ class SkinImage{
|
||||
private $data;
|
||||
|
||||
public function __construct(int $height, int $width, string $data){
|
||||
if(($expected = $height * $width * 4) !== ($actual = strlen($data))){
|
||||
throw new \InvalidArgumentException("Data should be exactly $expected bytes, got $actual bytes");
|
||||
}
|
||||
$this->height = $height;
|
||||
$this->width = $width;
|
||||
$this->data = $data;
|
||||
|
Loading…
x
Reference in New Issue
Block a user