How to Access ispendingkill property for an object in blueprint?

Hi. I call a setter function in my enemy character animation event graph. and I wrote c++ code to check if it is dead and destroy it if so. but after killing and destroying the enemy when i stop playing it gives me this error “enemy is pending kill” property from node “the setter function” in graph event graph in blueprint.
so how can i check if it is pending kill before calling that setter function?
it is possible in c++ as i saw before in “BatteryCollector tutorial” she used is pending kill on pickup object before destroying it.

i used bAutoDestroyWhenFinished=true instead of just destroy() but it destroys the enemy after a few seconds after it is dead and still gives me that error.

will my game crash if i leave it unsolved?

i used IsValid node and set its inputactor to my enemy but it still gives me that error

I found how to solve it. i added these nodes I marked