[view/map,bugfix][xs]: be more cautious about assuming a location field actually gains geodata (and geojson specifically).
* At present giving data with e.g. { location: 'New York'} would lead the view to crash on a JSON parsing error.
This commit is contained in:
@@ -345,8 +345,11 @@ my.Map = Backbone.View.extend({
|
|||||||
if (this.state.get('geomField')){
|
if (this.state.get('geomField')){
|
||||||
var value = doc.get(this.state.get('geomField'));
|
var value = doc.get(this.state.get('geomField'));
|
||||||
if (typeof(value) === 'string'){
|
if (typeof(value) === 'string'){
|
||||||
// We have a GeoJSON string representation
|
// We *may* have a GeoJSON string representation
|
||||||
return $.parseJSON(value);
|
try {
|
||||||
|
return $.parseJSON(value);
|
||||||
|
} catch(e) {
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// We assume that the contents of the field are a valid GeoJSON object
|
// We assume that the contents of the field are a valid GeoJSON object
|
||||||
return value;
|
return value;
|
||||||
|
|||||||
Reference in New Issue
Block a user