[SPIGOT-4031] ArrayIndexOutOfBoundsException in InventoryClickEvent.getCurrentItem() Created: 17/Jul/18 Updated: 17/Jul/18 Resolved: 17/Jul/18 |
|
Status: | Resolved |
Project: | Spigot |
Component/s: | None |
Affects Version/s: | None |
Fix Version/s: | None |
Type: | Bug | Priority: | Minor |
Reporter: | Brokkonaut | Assignee: | Hex |
Resolution: | Fixed | Votes: | 0 |
Labels: | InventoryClickEvent, inventory |
Version: | This server is running CraftBukkit version git-Spigot-1d0aef7-b4bff6f (MC: 1.13-pre7) (Implementing API version 1.13-pre7-R0.1-SNAPSHOT) |
Description |
When opening an inventory (for example player inventory), taking any item into the hand and clicking in an non-slot part of the ui (not outside and not on a slot) will throw an exception when trying to getCurrentItem() in the InventoryClickEvent: @EventHandler public void onClick(InventoryClickEvent event) { event.getCurrentItem(); //throws exception } throws java.lang.ArrayIndexOutOfBoundsException: -1 at java.util.ArrayList.elementData(Unknown Source) ~[?:1.8.0_172] at java.util.ArrayList.get(Unknown Source) ~[?:1.8.0_172] at net.minecraft.server.v1_13_R1.Container.getSlot(Container.java:110) ~[spigot-1.13-pre7.jar:git-Spigot-1d0aef7-b4bff6f] at org.bukkit.craftbukkit.v1_13_R1.inventory.CraftInventoryView.getItem(CraftInventoryView.java:65) ~[spigot-1.13-pre7.jar:git-Spigot-1d0aef7-b4bff6f] at org.bukkit.event.inventory.InventoryClickEvent.getCurrentItem(InventoryClickEvent.java:113) ~[spigot-1.13-pre7.jar:git-Spigot-1d0aef7-b4bff6f]
PPS: Bug reports which do not 1) contain a declaration of independence in Vanilla and without plugins, or 2) in the case of plugin API bugs, contain a minimal reproduction case (source + jar please) will be closed. Bug reports must contain step by step instructions to reproduce the bug from a clean server install with no assumptions or prior knowledge. Also make sure you include the full output of /version in your report. Please copy and paste this statement to the bottom of your report to indicate that you have read and understood it. PPPS: Failure to include the above statement will result in a 24 hour ban from the forums. |
Comments |
Comment by Hex [ 17/Jul/18 ] |
Fixed as of 1526726b579646244d3253d87a425a257719644b |
Comment by Brokkonaut [ 17/Jul/18 ] |
It's the same thing in 1.12. But I would clearly say its a bug, because if i click outside of the ui there is no exception (SlotType = RESULT (shouldn't this be OUTSIDE?), Slot = -999) the ItemStack is null. If I click on the ui I get the exception (SlotType = RESULT (why ever?), Slot = -1) |
Comment by md_5 [ 17/Jul/18 ] |
I don’t think this is new in 1.13 or even a bug. What does 1.12 return? |