Fixed search crash
This commit is contained in:
parent
b734cf76e2
commit
5bd4d5e37f
1 changed files with 9 additions and 2 deletions
|
@ -27,6 +27,7 @@ import net.osmand.plus.render.RenderingIcons;
|
|||
import net.osmand.search.core.CustomSearchPoiFilter;
|
||||
import net.osmand.search.core.SearchResult;
|
||||
import net.osmand.util.Algorithms;
|
||||
import net.osmand.util.GeoPointParserUtil.GeoParsedPoint;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
|
@ -193,8 +194,14 @@ public class QuickSearchListItem {
|
|||
}
|
||||
return typeStr;
|
||||
case LOCATION:
|
||||
LatLon latLon = (LatLon) searchResult.object;
|
||||
if (searchResult.localeRelatedObjectName == null) {
|
||||
LatLon latLon = null;
|
||||
if (searchResult.object instanceof LatLon) {
|
||||
latLon = (LatLon) searchResult.object;
|
||||
} else if (searchResult.object instanceof GeoParsedPoint) {
|
||||
GeoParsedPoint geoParsedPoint = (GeoParsedPoint) searchResult.object;
|
||||
latLon = new LatLon(geoParsedPoint.getLatitude(), geoParsedPoint.getLongitude());
|
||||
}
|
||||
if (latLon != null && searchResult.localeRelatedObjectName == null) {
|
||||
String locationCountry = app.getRegions().getCountryName(latLon);
|
||||
searchResult.localeRelatedObjectName = locationCountry == null ? "" : locationCountry;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue