aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBananeweizen <bananeweizen@gmx.de>2013-12-16 13:39:50 +0100
committerBananeweizen <bananeweizen@gmx.de>2013-12-16 13:39:50 +0100
commit30fd51684793322663ccec1dc28b13e17c12e302 (patch)
tree97a9fed9799faaa9741e1a25eefc46d865616d30
parent09ea341cf4c7cd95694a460e1513792e3b6f0245 (diff)
downloadcgeo-30fd51684793322663ccec1dc28b13e17c12e302.zip
cgeo-30fd51684793322663ccec1dc28b13e17c12e302.tar.gz
cgeo-30fd51684793322663ccec1dc28b13e17c12e302.tar.bz2
fix: NPE in search by geocode
-rw-r--r--main/src/cgeo/geocaching/Geocache.java8
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) {