#queue_free null crash

3 messages · Page 1 of 1 (latest)

ocean dragon
#
    entity.ai_component.queue_free()
    entity.ai_component = null

Cannot call method 'queue_free' on a null value.

Nowhere else in the code it is set to null, why is it throwing that error?

#

the error doesn't happen all the time either, Only when there is a large amount of enemies with high dps attacking the player and killing them

fading oak
#

If the code shown is the only place where ai_component is set to null, then this code must be called twice or more.

Just add an if statement around the queue_free call. You could also add a print statement on an else branch to satisfy any curiosity about how many times the code is called when ai_component is null.