summaryrefslogtreecommitdiff
path: root/platform/darwin/src/MGLMultiPoint.mm
diff options
context:
space:
mode:
authorMinh Nguyễn <mxn@1ec5.org>2017-04-06 08:30:34 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2017-04-06 09:22:51 -0700
commit83824203143d85b40362317ba76313b34be782e4 (patch)
tree8291d7dea18b2fb03a5ad8513bc8f8f1251795f7 /platform/darwin/src/MGLMultiPoint.mm
parentab6185fdc343448d3b6cbfc5e2bc91b5242fdf9f (diff)
downloadqtlocation-mapboxgl-83824203143d85b40362317ba76313b34be782e4.tar.gz
[ios, macos] Fail gracefully on invalid coordinates
Invalid coordinates no longer cause an exception to be raised immediately when used in conversion methods and model objects. Instead, the appropriate invalid values are used, consistent with MapKit. Exceptions are still raised when invalid model objects are used with the map.
Diffstat (limited to 'platform/darwin/src/MGLMultiPoint.mm')
-rw-r--r--platform/darwin/src/MGLMultiPoint.mm4
1 files changed, 4 insertions, 0 deletions
diff --git a/platform/darwin/src/MGLMultiPoint.mm b/platform/darwin/src/MGLMultiPoint.mm
index 4ab4ceb007..ef46bbb0fe 100644
--- a/platform/darwin/src/MGLMultiPoint.mm
+++ b/platform/darwin/src/MGLMultiPoint.mm
@@ -163,6 +163,10 @@
if (!_bounds) {
mbgl::LatLngBounds bounds = mbgl::LatLngBounds::empty();
for (auto coordinate : _coordinates) {
+ if (!CLLocationCoordinate2DIsValid(coordinate)) {
+ bounds = mbgl::LatLngBounds::empty();
+ break;
+ }
bounds.extend(MGLLatLngFromLocationCoordinate2D(coordinate));
}
_bounds = bounds;