Skip to content

Commit 6b6e584

Browse files
committed
added NaN and Infinity checks for Coordinate
1 parent eee8998 commit 6b6e584

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/PolylineAlgorithm/Coordinate.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ public Coordinate() {
4343
/// or when <paramref name="longitude"/> is less than -180 or greater than 180.
4444
/// </exception>
4545
public Coordinate(double latitude, double longitude) {
46-
if (latitude < -90 || latitude > 90) {
46+
if (latitude < -90 || latitude > 90 || double.IsNaN(latitude) || double.IsInfinity(latitude)) {
4747
throw new ArgumentOutOfRangeException(nameof(latitude), "Latitude must be between -90 and 90.");
4848
}
4949

50-
if (longitude < -180 || longitude > 180) {
50+
if (longitude < -180 || longitude > 180 || double.IsNaN(longitude) || double.IsInfinity(longitude)) {
5151
throw new ArgumentOutOfRangeException(nameof(longitude), "Longitude must be between -180 and 180.");
5252
}
5353

0 commit comments

Comments
 (0)