aboutsummaryrefslogtreecommitdiffstats
path: root/main/src
diff options
context:
space:
mode:
Diffstat (limited to 'main/src')
-rw-r--r--main/src/cgeo/geocaching/cgCache.java11
-rw-r--r--main/src/cgeo/geocaching/enumerations/CacheType.java12
2 files changed, 18 insertions, 5 deletions
diff --git a/main/src/cgeo/geocaching/cgCache.java b/main/src/cgeo/geocaching/cgCache.java
index 5406e90..edca68a 100644
--- a/main/src/cgeo/geocaching/cgCache.java
+++ b/main/src/cgeo/geocaching/cgCache.java
@@ -50,7 +50,7 @@ public class cgCache implements ICache {
private String geocode = "";
private String cacheId = "";
private String guid = "";
- private CacheType cacheType = null;
+ private CacheType cacheType = CacheType.UNKNOWN;
private String name = "";
private Spannable nameSp = null;
private String owner = "";
@@ -128,7 +128,7 @@ public class cgCache implements ICache {
if (StringUtils.isBlank(guid)) {
guid = other.getGuid();
}
- if (null == cacheType) {
+ if (null == cacheType || CacheType.UNKNOWN == cacheType) {
cacheType = other.getCacheType();
}
if (StringUtils.isBlank(name)) {
@@ -918,7 +918,12 @@ public class cgCache implements ICache {
}
public void setCacheType(CacheType cacheType) {
- this.cacheType = cacheType;
+ if (cacheType == null) {
+ this.cacheType = CacheType.UNKNOWN;
+ }
+ else {
+ this.cacheType = cacheType;
+ }
}
}
diff --git a/main/src/cgeo/geocaching/enumerations/CacheType.java b/main/src/cgeo/geocaching/enumerations/CacheType.java
index 1e58b70..e8f19cc 100644
--- a/main/src/cgeo/geocaching/enumerations/CacheType.java
+++ b/main/src/cgeo/geocaching/enumerations/CacheType.java
@@ -55,11 +55,19 @@ public enum CacheType {
}
public final static CacheType getById(final String id) {
- return CacheType.FIND_BY_ID.get(id.toLowerCase().trim());
+ final CacheType result = CacheType.FIND_BY_ID.get(id.toLowerCase().trim());
+ if (result == null) {
+ return UNKNOWN;
+ }
+ return result;
}
public final static CacheType getByPattern(final String pattern) {
- return CacheType.FIND_BY_PATTERN.get(pattern.toLowerCase().trim());
+ final CacheType result = CacheType.FIND_BY_PATTERN.get(pattern.toLowerCase().trim());
+ if (result == null) {
+ return UNKNOWN;
+ }
+ return result;
}
}