Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions src/Essentials/src/Types/Location.shared.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,11 @@ public Location(double latitude, double longitude, DateTimeOffset timestamp)
else
Latitude = latitude;

// make sure that longitude is in (-180, 180]
Longitude = longitude;
while (Longitude > 180)
Longitude -= 360;
while (Longitude <= -180)
Longitude += 360;
// check if longitude is in (-180, 180]
if (Math.Abs(latitude) > 180)
Copy link
Contributor

@dartasen dartasen Feb 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kubaflo @jfversluis I feel like it's a wrong copy paste here, it should be longitude inside the Math.abs...
I guess it does describe that this area is lacking of unit tests

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're absolutely right. I'm sorry about that. Here's the fix: #27834
@jfversluis could you please /azp

throw new ArgumentOutOfRangeException(nameof(longitude));
else
Longitude = longitude;

Timestamp = timestamp;
}
Expand Down
Loading