mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-05 11:27:07 +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:
parent
f7d66613df
commit
2cb6990698
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user