Project-RT / RandomTweaker

Provides many more mods support and great features for CraftTweaker.
https://www.curseforge.com/minecraft/mc-mods/randomtweaker
MIT License
21 stars 8 forks source link

NullPointerExeption for Entity with no aspects set #71

Closed TabakaSIM closed 7 months ago

TabakaSIM commented 11 months ago

I use mods.randomtweaker.thaumcraft.IEntity.getAspects(entity) to get entity aspects list. However if the entity doesn't have any set aspects (like zombie villager) it shows this error:

java.lang.NullPointerException
    at ink.ikx.rt.api.mods.thaumcraft.expand.ExpandIEntity.getAspects(ExpandIEntity.java:21)
    at do\Mithminite_scythe.vitreusCrystalize(do/mithminite_scythe.zs:741)
    at do\Mithminite_scythe.scytheEffectElemental(do/mithminite_scythe.zs:794)

Is there a way to return empty list for this case?

ikexing-cn commented 11 months ago

You can use isNull to handle with it, sry for now I don't have the free time to work on this issue, but PR welcome.

Krutoy242 commented 11 months ago

isNull can't be used here, because exception happen in Java code before any value returned to ZenScript.

ikexing-cn commented 7 months ago

Fixed, #be30b31