Closed vincentvaroquauxads closed 3 years ago
I had an issue with a JSON file where the field "type" was missing.
The function func (geo *Geometry) UnmarshalJSON(b []byte) error panics when it tries to dereference geojsonMap["type"].
func (geo *Geometry) UnmarshalJSON(b []byte) error
geojsonMap["type"]
I think it will be the same if "geometries" or "coordinates" is missing.
The function must check that key exists before dereferencing geojsonMap[key].
key
geojsonMap[key]
Thanks !
Good catch. I will look into this.
I had an issue with a JSON file where the field "type" was missing.
The function
func (geo *Geometry) UnmarshalJSON(b []byte) error
panics when it tries to dereferencegeojsonMap["type"]
.I think it will be the same if "geometries" or "coordinates" is missing.
The function must check that
key
exists before dereferencinggeojsonMap[key]
.Thanks !