[ios] fix route building error while searching when current location in none

Fixes issue https://github.com/organicmaps/organicmaps/issues/10606

Signed-off-by: Kiryl Kaveryn <kirylkaveryn@gmail.com>
This commit is contained in:
Kiryl Kaveryn
2025-05-26 17:27:21 +04:00
committed by Konstantin Pastbin
parent 7be49ab00a
commit 8a331c4c67
2 changed files with 14 additions and 14 deletions

View File

@@ -36,16 +36,16 @@
if (result.IsSuggest())
_suggestion = @(result.GetSuggestionString().c_str());
auto const & pivot = result.GetFeatureCenter();
_point = CGPointMake(pivot.x, pivot.y);
auto const location = mercator::ToLatLon(pivot);
_coordinate = CLLocationCoordinate2DMake(location.m_lat, location.m_lon);
CLLocation * lastLocation = [MWMLocationManager lastLocation];
if (lastLocation && result.HasPoint()) {
double distanceInMeters = mercator::DistanceOnEarth(lastLocation.mercator, result.GetFeatureCenter());
std::string distanceStr = platform::Distance::CreateFormatted(distanceInMeters).ToString();
_distanceText = @(distanceStr.c_str());
auto const & pivot = result.GetFeatureCenter();
_point = CGPointMake(pivot.x, pivot.y);
auto const location = mercator::ToLatLon(pivot);
_coordinate = CLLocationCoordinate2DMake(location.m_lat, location.m_lon);
} else {
_distanceText = nil;
}