diff --git a/OsmAnd-java/src/main/java/net/osmand/search/SearchUICore.java b/OsmAnd-java/src/main/java/net/osmand/search/SearchUICore.java index 520bfad345..6612ddd4cf 100644 --- a/OsmAnd-java/src/main/java/net/osmand/search/SearchUICore.java +++ b/OsmAnd-java/src/main/java/net/osmand/search/SearchUICore.java @@ -888,15 +888,20 @@ public class SearchUICore { } double s1 = o1.getSearchDistance(loc, 1); double s2 = o2.getSearchDistance(loc, 1); - if (o1.parentSearchResult != null && o2.parentSearchResult != null) { - if (o1.parentSearchResult == o2.parentSearchResult) { - int cmp = collator.compare(localeName1, localeName2); - if (cmp != 0) { - return cmp; - } - } - return Double.compare(s1, s2); + double ps1 = o1.parentSearchResult == null ? 0 : o1.parentSearchResult.getSearchDistance(loc); + double ps2 = o2.parentSearchResult == null ? 0 : o2.parentSearchResult.getSearchDistance(loc); + if (ps1 != ps2) { + return Double.compare(ps1, ps2); } +// if (o1.parentSearchResult != null && o2.parentSearchResult != null) { +// if (o1.parentSearchResult == o2.parentSearchResult) { +// int cmp = collator.compare(localeName1, localeName2); +// if (cmp != 0) { +// return cmp; +// } +// } +// return Double.compare(s1, s2); +// } int cmp = collator.compare(localeName1, localeName2); if (cmp != 0) { return cmp;