BananaPuncher714 / NBTEditor

A single class NBT editor for items, skulls, mobs, and tile entities
MIT License
136 stars 30 forks source link

Out of range TagList access should return null instead of throwing errors #22

Closed LOOHP closed 2 years ago

LOOHP commented 2 years ago

This PR adds a range check before accessing tag lists. In the documentation, methods are clearly stated that the target object "or null if none is stored at the provided location". Therefore if an item at index in a tag list does not exist, null should be returned instead of an out of bound exception.

Side note: Are variables named "notCompound" throughout different methods typos of "nbtCompound", or is it intentional?

BananaPuncher714 commented 2 years ago

The notCompound variables aren't typos, rather bad naming when I was writing it in the first place. It was more or less because it wasn't the compound for something, and I think copy and paste made it lose its meaning in other places.

LOOHP commented 2 years ago

Got it, thanks for the info!