From 3485dc86c725056932f6e923c2ba026858647ede Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Thu, 27 Feb 2020 15:47:37 +0200 Subject: [PATCH] Test fix --- .../java/net/osmand/search/SearchUICore.java | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) 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;