Fix crash when new players join due to attempting to send negative inventory slot

This commit is contained in:
Dylan K. Taylor
2017-05-29 15:24:11 +01:00
parent 57379b93ce
commit 2f306c3a38
2 changed files with 4 additions and 6 deletions

View File

@ -103,6 +103,7 @@ abstract class BaseInventory implements Inventory{
}
public function getItem($index){
assert($index >= 0, "Inventory slot should not be negative");
return isset($this->slots[$index]) ? clone $this->slots[$index] : Item::get(Item::AIR, 0, 0);
}