mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-04 08:56:15 +00:00
Enchantment: don't throw exceptions on out of range IDs
this function is used for data deserialization, and data may have bad enchantment IDs in it.
This commit is contained in:
@ -155,6 +155,9 @@ class Enchantment{
|
||||
* @return Enchantment|null
|
||||
*/
|
||||
public static function getEnchantment(int $id) : ?Enchantment{
|
||||
if($id < 0 or $id >= self::$enchantments->getSize()){
|
||||
return null;
|
||||
}
|
||||
return self::$enchantments[$id] ?? null;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user