With the latest build of Oxide it seems that the setup I have for OnEntityDeath is now broken, I'm not 100% sure why and maybe it's just the setup I am using.
It seems like Walls, Barricades, and when a server removes extra animal entities from the map the Hook throws a NullPointerException, Even with checks that say if the entities are not players then to just return false out the Exception sends.
The return being mainly:
I've even attempted to instead of checking with my main if to make this check it's own return like so:Code:NullReferenceException: Object reference not set to an instance of an object
However it still seems that this issue is slipping through the cracks anyway. Am I approaching this incorrectly? Even if the items sent back to the OnEntityDeath are not an object that means they should still fail the above check and stop the process.Code:attacker = hitinfo.Initiator; victim = entity; if (!attacker.ToPlayer() || !victim.ToPlayer()) return false;
Solved NullPointerException with OnEntityDeath (JS)
Discussion in 'Rust Discussion' started by KillParadise, May 19, 2015.
-
Check if attacker is undefined or null
-
The OnEntityDeath hook hasn't changed in months, keep in mind that hitinfo can be null (which is also mentioned in the docs).
-