[1.21.1] NPE in NBTEditor::getKeys
Closed this issue · 1 comments
Iseason2000 commented
test server: purpur-1.21.1-2285
NBTEditor Version: 7.19.3
example(Kotlin)
var clone = heldItem.clone() // any item
println(NBTEditor.getNBTCompound(clone))
val compound = NBTEditor.getEmptyNBTCompound()
compound.set("value1", "key1")
compound.set("value2", "key2")
compound.set("value3", "key3")
var set = NBTEditor.set(clone, compound, NBTEditor.CUSTOM_DATA, "custom-compound")
println(NBTEditor.getNBTCompound(set))
println(NBTEditor.getKeys(set, NBTEditor.CUSTOM_DATA, "custom-compound"))
log
[20:41:28 INFO]: {count:1,id:"minecraft:spruce_leaves"}
[20:41:28 INFO]: {components:{"minecraft:custom_data":{custom-compound:{key1:"value1",key2:"value2",key3:"value3"}}},count:1,id:"minecraft:spruce_leaves"}
[20:41:28 WARN]: [SakuraBind] Plugin SakuraBind v2.4.0 generated an exception while executing task 14
java.lang.NullPointerException: Cannot read field "tag" because the return value of "io.github.bananapuncher714.nbteditor.NBTEditor.getNBTTag(Object, Object[])" is null
at SakuraBind-2.4.0.jar/io.github.bananapuncher714.nbteditor.NBTEditor.getKeys(NBTEditor.java:1140) ~[SakuraBind-2.4.0.jar:?]
at SakuraBind-2.4.0.jar/top.iseason.bukkit.sakurabind.command.NBTCommand.onExecute$lambda$0(NBTCommand.kt:32) ~[SakuraBind-2.4.0.jar:?]
at SakuraBind-2.4.0.jar/top.iseason.bukkit.sakurabind.libs.core.command.CommandNode.onCommand$lambda$7(CommandNode.kt:232) ~[SakuraBind-2.4.0.jar:?]
at org.bukkit.craftbukkit.scheduler.CraftTask.run(CraftTask.java:86) ~[purpur-1.21.1.jar:1.21.1-2285-abf2f21]
at org.bukkit.craftbukkit.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:57) ~[purpur-1.21.1.jar:1.21.1-2285-abf2f21]
at com.destroystokyo.paper.ServerSchedulerReportingWrapper.run(ServerSchedulerReportingWrapper.java:22) ~[purpur-1.21.1.jar:?]
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) ~[?:?]
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) ~[?:?]
at java.base/java.lang.Thread.run(Thread.java:1583) ~[?:?]
BananaPuncher714 commented
Ok thanks. I'll take a look at this error. It should not affect regular usage through NBTEditor.getString()
and other getters aside from getKeys
.