geocoder: prevent crash on funky coordinates
This commit is contained in:
parent
21f277bc6a
commit
6d8a3afa9d
1 changed files with 4 additions and 1 deletions
|
@ -110,7 +110,10 @@ class CatalogMetadata {
|
|||
final double latitude, longitude;
|
||||
Address address;
|
||||
|
||||
CatalogMetadata({this.contentId, this.dateMillis, this.keywords, this.latitude, this.longitude});
|
||||
CatalogMetadata({this.contentId, this.dateMillis, this.keywords, double latitude, double longitude})
|
||||
// Geocoder throws an IllegalArgumentException when a coordinate has a funky values like 1.7056881853375E7
|
||||
: this.latitude = latitude < -90.0 || latitude > 90.0 ? null : latitude,
|
||||
this.longitude = longitude < -180.0 || longitude > 180.0 ? null : longitude;
|
||||
|
||||
factory CatalogMetadata.fromMap(Map map) {
|
||||
return CatalogMetadata(
|
||||
|
|
Loading…
Reference in a new issue