I tracked it down to line 403 and 416.
403: if (layer.featureCollection !== null) {
416 } else if (layer.layerObject !== null) {
Both line crash when object is undefined.
They should be
403: if (layer.featureCollection != null) {
416 } else if (layer.layerObject != null) {
which will detect both null and undefined.
I think this was right at a time in the past but somehow was reintroduced later on.
I narrowed this down to when you use the Search Settings to find a layer and you want to use that layers geometry to perform the lookup against all layers, not using the search by layer.
I tracked it down to line 403 and 416. 403: if (layer.featureCollection !== null) { 416 } else if (layer.layerObject !== null) { Both line crash when object is undefined.
They should be 403: if (layer.featureCollection != null) { 416 } else if (layer.layerObject != null) { which will detect both null and undefined.
I think this was right at a time in the past but somehow was reintroduced later on.