aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/Geocache.java
diff options
context:
space:
mode:
Diffstat (limited to 'main/src/cgeo/geocaching/Geocache.java')
-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) {