From d416ef0a6a24d25ac35f80f508d4c877c267a1f9 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Tue, 19 Jan 2021 16:44:57 +0100 Subject: [PATCH] Fix crash with search navigation --- .../src/main/java/net/osmand/data/Building.java | 8 ++++---- .../main/java/net/osmand/search/SearchUICore.java | 15 +++++---------- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/OsmAnd-java/src/main/java/net/osmand/data/Building.java b/OsmAnd-java/src/main/java/net/osmand/data/Building.java index 0adacd411a..5e16f755fc 100644 --- a/OsmAnd-java/src/main/java/net/osmand/data/Building.java +++ b/OsmAnd-java/src/main/java/net/osmand/data/Building.java @@ -182,10 +182,10 @@ public class Building extends MapObject { @Override public String toString() { - if(interpolationInterval !=0){ - return name+"-"+name2 +" (+"+interpolationInterval+") "; - } else if(interpolationType != null) { - return name+"-"+name2 +" ("+interpolationType+") "; + if (interpolationInterval != 0) { + return name + "-" + name2 + " (+" + interpolationInterval + ") "; + } else if (interpolationType != null) { + return name + "-" + name2 + " (" + interpolationType + ") "; } return name; } 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 df8c2bd5be..37c16393fa 100644 --- a/OsmAnd-java/src/main/java/net/osmand/search/SearchUICore.java +++ b/OsmAnd-java/src/main/java/net/osmand/search/SearchUICore.java @@ -1004,17 +1004,12 @@ public class SearchUICore { String subType2 = a2.getSubType() == null ? "" : a2.getSubType(); int cmp = 0; - - if (FILTER_DUPLICATE_POI_SUBTYPE.contains(subType1)) { - cmp = 1; - } else if (FILTER_DUPLICATE_POI_SUBTYPE.contains(subType2)) { - cmp = -1; - } - - if (cmp != 0) { - return cmp; + boolean subtypeFilter1 = FILTER_DUPLICATE_POI_SUBTYPE.contains(subType1); + boolean subtypeFilter2 = FILTER_DUPLICATE_POI_SUBTYPE.contains(subType2); + if (subtypeFilter1 != subtypeFilter2) { + // to filter second + return subtypeFilter1 ? 1 : -1; } - cmp = c.collator.compare(type1, type2); if (cmp != 0) { return cmp;