diff options
| author | Bananeweizen <bananeweizen@gmx.de> | 2013-12-16 13:39:50 +0100 |
|---|---|---|
| committer | Bananeweizen <bananeweizen@gmx.de> | 2013-12-16 13:39:50 +0100 |
| commit | 30fd51684793322663ccec1dc28b13e17c12e302 (patch) | |
| tree | 97a9fed9799faaa9741e1a25eefc46d865616d30 | |
| parent | 09ea341cf4c7cd95694a460e1513792e3b6f0245 (diff) | |
| download | cgeo-30fd51684793322663ccec1dc28b13e17c12e302.zip cgeo-30fd51684793322663ccec1dc28b13e17c12e302.tar.gz cgeo-30fd51684793322663ccec1dc28b13e17c12e302.tar.bz2 | |
fix: NPE in search by geocode
| -rw-r--r-- | main/src/cgeo/geocaching/Geocache.java | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/main/src/cgeo/geocaching/Geocache.java b/main/src/cgeo/geocaching/Geocache.java index 40d67fb..bded7d0 100644 --- a/main/src/cgeo/geocaching/Geocache.java +++ b/main/src/cgeo/geocaching/Geocache.java @@ -1581,7 +1581,7 @@ public class Geocache implements ICache, IWaypoint { public static void storeCache(Geocache origCache, String geocode, int listId, boolean forceRedownload, CancellableHandler handler) { try { - Geocache cache; + Geocache cache = null; // get cache details, they may not yet be complete if (origCache != null) { SearchResult search = null; @@ -1596,9 +1596,9 @@ public class Geocache implements ICache, IWaypoint { } } else if (StringUtils.isNotBlank(geocode)) { final SearchResult search = searchByGeocode(geocode, null, listId, forceRedownload, handler); - cache = search.getFirstCacheFromResult(LoadFlags.LOAD_CACHE_OR_DB); - } else { - cache = null; + if (search != null) { + cache = search.getFirstCacheFromResult(LoadFlags.LOAD_CACHE_OR_DB); + } } if (cache == null) { |
