diff options
| author | Bananeweizen <Bananeweizen@gmx.de> | 2012-04-09 11:22:48 +0200 |
|---|---|---|
| committer | Samuel Tardieu <sam@rfc1149.net> | 2012-04-09 12:07:45 +0200 |
| commit | ffae19d2f53c90f2ec0d883c6780484e5d1a0f09 (patch) | |
| tree | 49f34358b967a588d98c2de0c3554f19f80c6704 /main/src | |
| parent | 2266c5a6a22c027092bc93d5976fb3c0e6bd6187 (diff) | |
| download | cgeo-ffae19d2f53c90f2ec0d883c6780484e5d1a0f09.zip cgeo-ffae19d2f53c90f2ec0d883c6780484e5d1a0f09.tar.gz cgeo-ffae19d2f53c90f2ec0d883c6780484e5d1a0f09.tar.bz2 | |
#1384: FC when apply a filter
Diffstat (limited to 'main/src')
| -rw-r--r-- | main/src/cgeo/geocaching/cgData.java | 10 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/filter/AttributeFilter.java | 5 |
2 files changed, 6 insertions, 9 deletions
diff --git a/main/src/cgeo/geocaching/cgData.java b/main/src/cgeo/geocaching/cgData.java index b015344..3f48b07 100644 --- a/main/src/cgeo/geocaching/cgData.java +++ b/main/src/cgeo/geocaching/cgData.java @@ -1801,14 +1801,8 @@ public class cgData { throw new IllegalArgumentException("geocode must not be empty"); } - Set<String> geocodes = new HashSet<String>(); - geocodes.add(geocode); - - Set<cgCache> caches = loadCaches(geocodes, loadFlags); - if (caches != null && caches.size() >= 1) { - return (cgCache) caches.toArray()[0]; - } - return null; + final Set<cgCache> caches = loadCaches(Collections.singleton(geocode), loadFlags); + return caches.isEmpty() ? null : caches.iterator().next(); } /** diff --git a/main/src/cgeo/geocaching/filter/AttributeFilter.java b/main/src/cgeo/geocaching/filter/AttributeFilter.java index 0ef0787..7b8992b 100644 --- a/main/src/cgeo/geocaching/filter/AttributeFilter.java +++ b/main/src/cgeo/geocaching/filter/AttributeFilter.java @@ -34,7 +34,10 @@ public class AttributeFilter extends AbstractFilter { @Override public boolean accepts(final cgCache cache) { - final cgCache fullCache = cgeoapplication.getInstance().loadCache(cache.getGeocode(), EnumSet.of(LoadFlag.LOAD_ATTRIBUTES)); + cgCache fullCache = cgeoapplication.getInstance().loadCache(cache.getGeocode(), EnumSet.of(LoadFlag.LOAD_ATTRIBUTES)); + if (fullCache == null) { + fullCache = cache; + } return fullCache.getAttributes().contains(attribute); } |
