From 1c116bb13c7354dfa418610c1359918292e61ded Mon Sep 17 00:00:00 2001 From: Bukkit/Spigot Date: Sun, 30 Dec 2018 22:27:16 +1100 Subject: [PATCH] Ignore spurious slot IDs sent by client, e.g. in enchanting tables By: md_5 --- .../src/main/java/org/bukkit/inventory/InventoryView.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/paper-api/src/main/java/org/bukkit/inventory/InventoryView.java b/paper-api/src/main/java/org/bukkit/inventory/InventoryView.java index 84d476a732..e13e3e3385 100644 --- a/paper-api/src/main/java/org/bukkit/inventory/InventoryView.java +++ b/paper-api/src/main/java/org/bukkit/inventory/InventoryView.java @@ -210,7 +210,9 @@ public abstract class InventoryView { * @return corresponding inventory, or null */ public final Inventory getInventory(int rawSlot) { - if (rawSlot == OUTSIDE) { + // Slot may be -1 if not properly detected due to client bug + // e.g. dropping an item into part of the enchantment list section of an enchanting table + if (rawSlot == OUTSIDE || rawSlot == -1) { return null; } Preconditions.checkArgument(rawSlot >= 0, "Negative, non outside slot %s", rawSlot);