diff options
| author | bananeweizen <bananeweizen@gmx.de> | 2011-10-31 19:21:25 +0100 |
|---|---|---|
| committer | bananeweizen <bananeweizen@gmx.de> | 2011-10-31 19:21:25 +0100 |
| commit | 5bf29d09cf3d19e863e7bdca3dbe3d108c137799 (patch) | |
| tree | a84ab256f5fb5dd10f039a9dbc36ad9acb04a8da /main/src/cgeo/geocaching/cgCache.java | |
| parent | 28f8b812092ebe6015a53f0f60bc838ffe24f270 (diff) | |
| download | cgeo-5bf29d09cf3d19e863e7bdca3dbe3d108c137799.zip cgeo-5bf29d09cf3d19e863e7bdca3dbe3d108c137799.tar.gz cgeo-5bf29d09cf3d19e863e7bdca3dbe3d108c137799.tar.bz2 | |
avoid NPE when accessing cache type, #737
Diffstat (limited to 'main/src/cgeo/geocaching/cgCache.java')
| -rw-r--r-- | main/src/cgeo/geocaching/cgCache.java | 11 |
1 files changed, 8 insertions, 3 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; + } } } |
