How to check is pointer pointing to valid Object (that was not queued free) in GDNative C++?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Robotex

I have a bots. Each bot has Area2D and saves all bots that entered it into sensory memory as raw pointers to Node, given as argument of signal processing function:

void _on_PerceptionArea_body_entered(Node * body) {
...
}

When some bot is died, it calls queue_free() for itself.

But then I get crash because I try to access pointer to deleted bot in sensory memory.

Is it possible to check is pointer still valid? Or maybe is there a way to convert that pointer to something that will protect me from crashing?