Querz / NBT

A java implementation of the NBT protocol, including a way to implement custom tags.
MIT License
182 stars 48 forks source link

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

Closed HoldYourWaffle closed 1 year ago

HoldYourWaffle commented 2 years ago

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.

Querz commented 2 years ago

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.

HoldYourWaffle commented 2 years ago

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

HoldYourWaffle commented 2 years ago

Whoops, github does not like renaming branches...