forked from organicmaps/organicmaps
[new downloader][ios] Fixed empty country search result handling.
This commit is contained in:
parent
9fbb229c17
commit
44dcdce3ff
2 changed files with 7 additions and 4 deletions
|
@ -35,9 +35,12 @@ extern NSString * const kPlaceCellIdentifier;
|
|||
if (!it->HasPoint())
|
||||
continue;
|
||||
auto const & mercator = it->GetFeatureCenter();
|
||||
NSString * countryId = @(countryInfoGetter.GetRegionCountryId(mercator).c_str());
|
||||
[nsSearchCoutryIds addObject:countryId];
|
||||
nsSearchResults[countryId] = @(it->GetString().c_str());
|
||||
TCountryId countryId = countryInfoGetter.GetRegionCountryId(mercator);
|
||||
if (countryId == kInvalidCountryId)
|
||||
continue;
|
||||
NSString * nsCountryId = @(countryId.c_str());
|
||||
[nsSearchCoutryIds addObject:nsCountryId];
|
||||
nsSearchResults[nsCountryId] = @(it->GetString().c_str());
|
||||
}
|
||||
NSAssert(nsSearchCoutryIds.count != 0, @"Search results can not be empty.");
|
||||
self.searchCoutryIds = [nsSearchCoutryIds array];
|
||||
|
|
|
@ -53,7 +53,7 @@ private:
|
|||
TCountryId CountryInfoGetter::GetRegionCountryId(m2::PointD const & pt) const
|
||||
{
|
||||
IdType const id = FindFirstCountry(pt);
|
||||
return id != kInvalidId ? m_countries[id].m_name : TCountryId();
|
||||
return id != kInvalidId ? m_countries[id].m_name : kInvalidCountryId;
|
||||
}
|
||||
|
||||
void CountryInfoGetter::GetRegionsCountryId(m2::PointD const & pt, TCountriesVec & closestCoutryIds)
|
||||
|
|
Loading…
Add table
Reference in a new issue