Access violation with "null pointer check"

Hi there,

From your question and comments it appears your problem is that the pointer itself is being invalidated between calls.

That is to say, a pointer is an address in memory, quite literally just a number that leads to a location.
If you store an address it doesn’t provide any assurance the object pointed-to is valid, nor does it ensure you have not stored an invalid value in a pointer.

Just like having an address to your school-friends house doesn’t ensure that your friend hasn’t moved out, or the house been demolished.

In short, do not store a pointer to an object in the world if it is remotely possible to find that object via any other mechanism. If you absolutely must store a pointer to an actor that may be destroyed, removed or changed, please use a UProperty or smart pointer to prevent the pointer not being updated on the objects destruction.

1 Like