From ce15272916a615c54ac8481cfded2384bdc761a3 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Wed, 19 Oct 2016 11:32:20 +0200 Subject: [PATCH] Fix search core --- .../src/net/osmand/search/SearchUICore.java | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/OsmAnd-java/src/net/osmand/search/SearchUICore.java b/OsmAnd-java/src/net/osmand/search/SearchUICore.java index c752f2dc79..74f1918ffd 100644 --- a/OsmAnd-java/src/net/osmand/search/SearchUICore.java +++ b/OsmAnd-java/src/net/osmand/search/SearchUICore.java @@ -108,6 +108,7 @@ public class SearchUICore { searchResults.add(addedResult); } j++; + i = searchResults.size(); continue; } SearchResult existingResult = searchResults.get(i); @@ -118,6 +119,7 @@ public class SearchUICore { int compare = cmp.compare(existingResult, addedResult); if(compare == 0) { // existingResult == addedResult + this.searchResults.add(addedResults.get(j)); j++; } else if(compare > 0) { // existingResult > addedResult @@ -526,17 +528,10 @@ public class SearchUICore { if(cmp != 0) { return cmp; } - - Amenity a1 = null; - if(o1.object instanceof Amenity) { - a1 = (Amenity) o1.object; - } - Amenity a2 = null; - if(o2.object instanceof Amenity) { - a2 = (Amenity) o2.object; - } - if (a1 != null && a2 != null) { + if (o1.object instanceof Amenity && o2.object instanceof Amenity) { // here 2 points are amenity + Amenity a1 = (Amenity) o1.object; + Amenity a2 = (Amenity) o2.object; String type1 = a1.getType().getKeyName(); String type2 = a2.getType().getKeyName(); String subType1 = a1.getSubType();