Sort by distance don't work

fix #4260: sort by distance doesn't work
What does it mean to have the `list` set to `null`? As soon as `compareCaches()` will be called, then `calculateAllDistances` will be called as well, and there will be a `NullPointerException` in the `for` loop.

Does it mean that `compareCaches()` will never be called on the singleton? If this is the case, why not use `null` instead of this singleton?

I'm not sure I follow the logic here.