From 98ac6fc7be302cf2e6a6bbb5f6cd6a2ae7ac1353 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Tue, 28 Nov 2017 16:56:02 +0000 Subject: [PATCH] Check inventory slot is in range in SlotChangeAction --- .../inventory/transaction/action/SlotChangeAction.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/pocketmine/inventory/transaction/action/SlotChangeAction.php b/src/pocketmine/inventory/transaction/action/SlotChangeAction.php index dfb7a46dc..3fe2a3925 100644 --- a/src/pocketmine/inventory/transaction/action/SlotChangeAction.php +++ b/src/pocketmine/inventory/transaction/action/SlotChangeAction.php @@ -75,8 +75,11 @@ class SlotChangeAction extends InventoryAction{ * @return bool */ public function isValid(Player $source) : bool{ - $check = $this->inventory->getItem($this->inventorySlot); - return $check->equalsExact($this->sourceItem); + return ( + $this->inventorySlot >= 0 and + $this->inventorySlot < $this->inventory->getSize() and + $this->inventory->getItem($this->inventorySlot)->equalsExact($this->sourceItem) + ); } /**