NBT icon indicating copy to clipboard operation
NBT copied to clipboard

Prevent null keys and values and EndTag values in CompoundTag and ListTag

Open HoldYourWaffle opened this issue 2 years ago • 3 comments

Title says it all :)

NBT doesn't have a concept of null, and CompoundTag is clearly not designed for null keys or values. In the interest of failing fast it'd be good to reject any rogue null's upfront.

Edit: I also added a check to prevent EndTag values in CompoundTag. ListTag's updateType already took care of this.

HoldYourWaffle avatar Aug 12 '22 21:08 HoldYourWaffle

Since this PR also addresses the array tags:

ListTag should have a check in the ListTag(List<Tag>, byte) constructor, because its underlying value should not be null.

Querz avatar Aug 13 '22 23:08 Querz

Good catch, I've added some checks in ListTag :)

HoldYourWaffle avatar Aug 14 '22 00:08 HoldYourWaffle

Whoops, github does not like renaming branches...

HoldYourWaffle avatar Aug 14 '22 00:08 HoldYourWaffle