[SPIGOT-7637] Bad logic in checking nullability of AttributeModifier slots Created: 25/Apr/24 Updated: 25/Dec/24 Resolved: 25/Apr/24 |
|
Status: | Resolved |
Project: | Spigot |
Component/s: | None |
Affects Version/s: | None |
Fix Version/s: | None |
Type: | Bug | Priority: | Minor |
Reporter: | William278 | Assignee: | Marvin Rieple |
Resolution: | Fixed | Votes: | 0 |
Labels: | None | ||
Environment: |
Java 21 |
Version: | 1.20.5-R0.1-SNAPSHOT |
Guidelines Read: | Yes |
Description |
AttributeModifier changed from storing a Nullable EquipmentSlot to a NotNull EquipmentSlotGroup at some point (I think with 1.20.5?), but there's a nullability flaw with the API implementation here.
Suggested fix: Add a Preconditions check preventing slot from being passed as null and change the constructor call here to pass null to the other constructor which accepts an EquipmentSlot (which correctly converts EquipmentSlot to EquipmentSlotGroup in a ternary). Thanks for your hard work.
|
Comments |
Comment by Marvin Rieple [ 25/Apr/24 ] |
Made a PR for this: bukkit#1000 You can test it with BuildTools: java -jar BuildTools.jar --rev 4123 --compile spigot --pr bukkit:1000 |