NBT-API

NBT-API

98.9k Downloads

NullPointerException on NBTCompound#asNBTString

i0xHeX opened this issue ยท 1 comments

commented

Reproduce:

  • Take clean item (arrow for example) and try to make it into string:
52: NBTItem nbtItem = new NBTItem(item);
53: String data = nbtItem.asNBTString();
  • Get NPE error.
Caused by: java.lang.NullPointerException
	at de.tr7zw.itemnbtapi.NBTCompound.asNBTString(NBTCompound.java:192) ~[?:?]
	at ua.i0xhex.plugin.MyListener.onClick(MyListener.java:53) ~[?:?]
	... X more
commented

Huh can confirm. I'll change this to return the expected "{}".
NBTItem.convertItemtoNBT(item).asNBTString() seems to handle this case correctly, but also includes non NBT data like the amount and material.