Null Reference Exception

I was a little puzzled by the Null Reference Exception error. After some testing I found I was getting it if the player moved away after the animation had started, but hadn’t yet reached the Hit() event, and so by the time the Hit() event executed, the target had been cleared.

I’ve added in a line to the Hit() event to return if the target is null, and this seems to rectify it.

I probably should have waited for Rick/Sam to deal with it as I’m sure they will, and hope that my solution doesn’t cause issues down the line, but there’s a part of me that has to at least try and figure out problems as I come across them.

1 Like

That is exactly the correct solution to the issue, and it won’t cause any problems down the line.

That’s great Brian, thanks very much for the feedback.

Privacy & Terms