Fix issue #2262

This attempts to fix issue #2262 and some surrounding things I've found whilst doing so.

Firstly evaluated that assert, it's benign as far as I can tell. A hangover from an earlier way of getting data to/from the patch when I used to pass the GeoPatches pointer around with the request.

It did lead me to a couple of cases though where things weren't being cleaned up if finding a GeoSphere or GeoPatch should fail.

Also I've added some more sanity checking.