Made GetSpawnOccupants more robust against invalid list queries

Hopefully finally fixes #5588.