[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:
parent
c6d4116cba
commit
ea6f051aba
@ -345,8 +345,11 @@ my.Map = Backbone.View.extend({
|
||||
if (this.state.get('geomField')){
|
||||
var value = doc.get(this.state.get('geomField'));
|
||||
if (typeof(value) === 'string'){
|
||||
// We have a GeoJSON string representation
|
||||
return $.parseJSON(value);
|
||||
// We *may* have a GeoJSON string representation
|
||||
try {
|
||||
return $.parseJSON(value);
|
||||
} catch(e) {
|
||||
}
|
||||
} else {
|
||||
// We assume that the contents of the field are a valid GeoJSON object
|
||||
return value;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user