From fd123de8ad060441cdd318091531653df4cbcc79 Mon Sep 17 00:00:00 2001 From: Bruno de Oliveira Abinader Date: Thu, 3 Mar 2016 00:35:05 +0200 Subject: [core] Regression fix in LatLng::unwrapForShortestPath When porting this from Transform::unwrapLatLng, I forgot to check for the second alternative. Fixes #4174. --- include/mbgl/util/geo.hpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'include/mbgl/util/geo.hpp') diff --git a/include/mbgl/util/geo.hpp b/include/mbgl/util/geo.hpp index 755abeda21..56d575ceaa 100644 --- a/include/mbgl/util/geo.hpp +++ b/include/mbgl/util/geo.hpp @@ -33,7 +33,11 @@ public: coordinate so that interpolating between the two endpoints will cross it. */ void unwrapForShortestPath(const LatLng& start) { if (std::abs(start.longitude) + std::abs(longitude) > util::LONGITUDE_MAX) { - longitude += (start.longitude > 0 && longitude < 0) ? util::DEGREES_MAX : -util::DEGREES_MAX; + if (start.longitude > 0 && longitude < 0) { + longitude += util::DEGREES_MAX; + } else if (start.longitude < 0 && longitude > 0) { + longitude -= util::DEGREES_MAX; + } } } -- cgit v1.2.1