Skip to content

Commit

Permalink
fix /give crash when asking for an item by name that doesn't have a d…
Browse files Browse the repository at this point in the history
…efined ID
  • Loading branch information
dktapps committed Oct 18, 2021
1 parent d17e1bb commit b2c44bb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/pocketmine/item/Item.php
Original file line number Diff line number Diff line change
Expand Up @@ -1754,8 +1754,10 @@ public static function fromString($str, $multiple = false) {
if ($item->getId() === self::AIR and strtoupper($b[0]) !== "AIR") {
$item = self::get($b[0] & 0xFFFF, $meta);
}
} elseif (is_numeric($b[0])) {
$item = self::get(((int) $b[0]) & 0xFFFF, $meta);
} else {
$item = self::get($b[0] & 0xFFFF, $meta);
$item = self::get(self::AIR);
}

return $item;
Expand Down

0 comments on commit b2c44bb

Please sign in to comment.