-
Type:
Bug
-
Resolution: Fixed
-
Priority:
Minor
-
None
-
Affects Version/s: None
-
Environment:
Windows 10 x64,
OpenJDK 64-Bit Server VM AdoptOpenJDK-16.0.1+9
-
This server is running CraftBukkit version 3188-Spigot-d03d7f1-c851639 (MC: 1.17.1) (Implementing API version 1.17.1-R0.1-SNAPSHOT)
-
InventoryRollbackPlus
-
Yes
Hello!
I have the following issue that I believe is caused by a subtle bug in the spigot code.
The Issue
When trying to add new items to a bundle when using the BukkitObjectOutputStream/BukkitObjectInputStream, it throws a NPE saying
java.lang.NullPointerException: Cannot invoke "java.util.List.add(Object)" because "this.items" is null
This seems to be caused by these lines I highlighted https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBundle.java#35-37,46-47.]
Related stacktrace of the NPE https://pastebin.com/raw/c7Msfd0n
Expected behavior
Ability to use a BukkitObjectInputStream to create a bundle object.
(Noob's suggestion for fix: Initialize the this.items array upon instance creation. This could be completely wrong but I would be interested to hear what you think the problem could be ^^)
Provided API Test Jar
Run /kill with a non-empty bundle in your inventory. (/kill is used since this bug-producing code is from the InventoryRollbackPlus plugin, which triggers on death xD)
Test Plugin source: https://github.com/TechnicallyCoded/SpigotApiBugReport-Bundles