From 022ed7e705b7acb80f4336a386ea690a2234eefc Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Sun, 24 May 2020 19:55:19 +0200 Subject: [PATCH] Fix critical bug in search comparator --- .../src/main/java/net/osmand/search/core/SearchPhrase.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/OsmAnd-java/src/main/java/net/osmand/search/core/SearchPhrase.java b/OsmAnd-java/src/main/java/net/osmand/search/core/SearchPhrase.java index 8f6799e3be..b15c5a377a 100644 --- a/OsmAnd-java/src/main/java/net/osmand/search/core/SearchPhrase.java +++ b/OsmAnd-java/src/main/java/net/osmand/search/core/SearchPhrase.java @@ -121,6 +121,11 @@ public class SearchPhrase { int i1 = CommonWords.getCommonSearch(o1.toLowerCase()); int i2 = CommonWords.getCommonSearch(o2.toLowerCase()); if (i1 != i2) { + if(i1 == -1) { + return -1; + } else if(i2 == -1) { + return 1; + } return -icompare(i1, i2); } // compare length without numbers to not include house numbers