From 348a4e22ad2add4056345003efa55f3bad22e736 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Thu, 9 Oct 2014 00:53:45 +0200 Subject: [PATCH] Fix NPE --- .../net/osmand/plus/resources/ResourceManager.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/resources/ResourceManager.java b/OsmAnd/src/net/osmand/plus/resources/ResourceManager.java index f751d70d9f..d755d38b96 100644 --- a/OsmAnd/src/net/osmand/plus/resources/ResourceManager.java +++ b/OsmAnd/src/net/osmand/plus/resources/ResourceManager.java @@ -728,7 +728,7 @@ public class ResourceManager { LatLon l = a.getLocation(); if (l != null && l.getLatitude() <= topLatitude && l.getLatitude() >= bottomLatitude && l.getLongitude() >= leftLongitude && l.getLongitude() <= rightLongitude) { - if (matcher.publish(a)) { + if (matcher == null || matcher.publish(a)) { amenities.add(a); } } @@ -743,16 +743,18 @@ public class ResourceManager { new ResultMatcher() { @Override - public boolean publish(Amenity object) { - if (checkNameFilter(object, filterByName)) { - return matcher.publish(object); + public boolean publish(Amenity a) { + if (checkNameFilter(a, filterByName)) { + if (matcher == null || matcher.publish(a)) { + amenities.add(a); + } } return false; } @Override public boolean isCancelled() { - return matcher.isCancelled(); + return matcher != null && matcher.isCancelled(); } }); }