summaryrefslogtreecommitdiff
path: root/platform/darwin/src/MGLGeometry_Private.h
diff options
context:
space:
mode:
Diffstat (limited to 'platform/darwin/src/MGLGeometry_Private.h')
-rw-r--r--platform/darwin/src/MGLGeometry_Private.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/platform/darwin/src/MGLGeometry_Private.h b/platform/darwin/src/MGLGeometry_Private.h
index e6b37b3530..ac0ff485aa 100644
--- a/platform/darwin/src/MGLGeometry_Private.h
+++ b/platform/darwin/src/MGLGeometry_Private.h
@@ -13,6 +13,18 @@
CGRect MGLExtendRect(CGRect rect, CGPoint point);
NS_INLINE mbgl::LatLng MGLLatLngFromLocationCoordinate2D(CLLocationCoordinate2D coordinate) {
+ if (std::isnan(coordinate.latitude)) {
+ [NSException raise:NSInvalidArgumentException format:@"latitude must not be NaN"];
+ }
+ if (std::isnan(coordinate.longitude)) {
+ [NSException raise:NSInvalidArgumentException format:@"longitude must not be NaN"];
+ }
+ if (std::abs(coordinate.latitude) > 90.0) {
+ [NSException raise:NSInvalidArgumentException format:@"latitude must be between -90 and 90"];
+ }
+ if (!std::isfinite(coordinate.longitude)) {
+ [NSException raise:NSInvalidArgumentException format:@"longitude must not be infinite"];
+ }
return mbgl::LatLng(coordinate.latitude, coordinate.longitude);
}