Quite an odd question but I have a fatal error about a variable returned by get_collider from a raycast.
Usually it returns null or an object. And the condition "extends" does the job to tell if the object type is valid.
But sometimes, especially with lot of free_queue happening at the same time, the variable is the number 0. And godot doesn't like doing an extends on a number. It does not like it at all. It says
Left operand of 'extends' is not an instance of anything.
But if I try to check if the variable != 0, it crashes as well and says:
Invalid operands 'Object' and 'int' in operator '!='.
Then how am I supposed to avoid the error?