From 3c996a41a911c325b078c438cfb3da264b473f44 Mon Sep 17 00:00:00 2001 From: PaulStets Date: Sat, 28 Apr 2018 15:32:07 +0300 Subject: [PATCH] Fixed unused array --- .../plus/wikivoyage/data/TravelDbHelper.java | 33 ++++++++++--------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelDbHelper.java b/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelDbHelper.java index 388cbed36e..bc3fb3f4ed 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelDbHelper.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelDbHelper.java @@ -362,22 +362,23 @@ public class TravelDbHelper { cursor.close(); } LinkedHashMap> res = new LinkedHashMap<>(); - parts = parts == null ? new String[]{} : parts; - for (String header : parts) { - WikivoyageSearchResult searchResult = headerObjs.get(header); - List results = navMap.get(header); - if (results != null) { - Collections.sort(results, new Comparator() { - @Override - public int compare(WikivoyageSearchResult o1, WikivoyageSearchResult o2) { - return collator.compare(o1.articleTitles.get(0), o2.articleTitles.get(0)); - } - }); - WikivoyageSearchResult emptyResult = new WikivoyageSearchResult(); - emptyResult.articleTitles.add(header); - emptyResult.cityId = -1; - searchResult = searchResult != null ? searchResult : emptyResult; - res.put(searchResult, results); + if (parts != null) { + for (String header : parts) { + WikivoyageSearchResult searchResult = headerObjs.get(header); + List results = navMap.get(header); + if (results != null) { + Collections.sort(results, new Comparator() { + @Override + public int compare(WikivoyageSearchResult o1, WikivoyageSearchResult o2) { + return collator.compare(o1.articleTitles.get(0), o2.articleTitles.get(0)); + } + }); + WikivoyageSearchResult emptyResult = new WikivoyageSearchResult(); + emptyResult.articleTitles.add(header); + emptyResult.cityId = -1; + searchResult = searchResult != null ? searchResult : emptyResult; + res.put(searchResult, results); + } } } return res;