Calling ArmorModifier::getItems() throws NPE if no items exist
ejektaflex opened this issue ยท 2 comments
Versions (Be specific, do not write "latest"):
- Construct's Armory: 1.0.2
- Tinkers' Construct: 2.10.1.87
- Mantle: 1.3.2.25
- Forge: 14.23.4.2705
Observed Behavior:
I'm trying to call ArmorModifier::getItems(), but if there are no registered items associated with the modifier, it calls a NullPointerException. My mod checks each modifier and only will create book pages if the modifier has items, which causes this issue (I have to load pages for modifiers only if the mods those items come from are loaded).
Expected Behavior:
It should simply return null if there are no associated items. ModifierTrait::getItems() does not have this issue.
Steps to Reproduce:
- Call .getItems() on an ArmorModifier with no items.
...
gist crash log here.
This will be fixed in the next update. Although instead of returning null like you stated in your expected behavior statement, it will return an empty list if there are no associated items.
Alright, perfect. I actually was about to modify my issue, though, since I may have actually run into the same problem for the ModifierTrait version as well (not quite sure on that). If so, I feel like it is something that could be fixed in TiC as well (I threw it into a try/catch for now and it's all fine).
Thanks!