Reason for null check in squash the creep - squash mechanic

Godot Version

4.3

Question

In the squash mechanic section a null check is performed after calling get_collider with a comment stating it is for the floor.

The documentation doesn’t mention a null return case but I would guess its when a collider with the provided index doesn’t exist, yet the comment states otherwise. However that doesn’t seem to be the case as I was only able to get a null value by squashing creeps.

My understanding is that when a creep gets squashed the creep is queued to be freed and this causes the next index possibly being a collision for the creep that was removed when the collision happened on multiple points for a single creep.

Is the comment stating the check is for a floor incorrect or is there something else I am missing here?

You are right, the reason for the check are multiple collisions with the same ‘mob’. The latest version of the documentation (you can change that at the bottom right) actually has an updated comment: Jumping and squashing monsters — Godot Engine (latest) documentation in English

However, I don’t think the check is needed at all since the loop is exited (break) when the first mob is squashed.