From f8f71ca0f99d81f57167ae5a6e4beabc2b8c2a30 Mon Sep 17 00:00:00 2001 From: Alexander Sytnyk Date: Fri, 2 Feb 2018 12:34:01 +0200 Subject: [PATCH] Fix NPE that occurs while search amenities --- OsmAnd/src/net/osmand/plus/resources/ResourceManager.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/resources/ResourceManager.java b/OsmAnd/src/net/osmand/plus/resources/ResourceManager.java index 704004f8b8..a41fbfea9b 100644 --- a/OsmAnd/src/net/osmand/plus/resources/ResourceManager.java +++ b/OsmAnd/src/net/osmand/plus/resources/ResourceManager.java @@ -716,18 +716,18 @@ public class ResourceManager { int left31 = MapUtils.get31TileNumberX(leftLongitude); int bottom31 = MapUtils.get31TileNumberY(bottomLatitude); int right31 = MapUtils.get31TileNumberX(rightLongitude); - List fileNames = new ArrayList(amenityRepositories.keySet()); + List fileNames = new ArrayList<>(amenityRepositories.keySet()); Collections.sort(fileNames, Algorithms.getStringVersionComparator()); for (String name : fileNames) { - AmenityIndexRepository index = amenityRepositories.get(name); if (matcher != null && matcher.isCancelled()) { searchAmenitiesInProgress = false; break; } - if (index.checkContainsInt(top31, left31, bottom31, right31)) { + AmenityIndexRepository index = amenityRepositories.get(name); + if (index != null && index.checkContainsInt(top31, left31, bottom31, right31)) { List r = index.searchAmenities(top31, left31, bottom31, right31, zoom, filter, matcher); - if(r != null) { + if (r != null) { amenities.addAll(r); } }