aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBananeweizen <bananeweizen@gmx.de>2011-10-24 20:50:13 +0200
committerBananeweizen <bananeweizen@gmx.de>2011-10-24 20:50:13 +0200
commit980756db69a32c6a845c51f4a229c583c6dec70f (patch)
tree5efe848b6da49ce6a87422524c1f2fdbf800a0b2
parentaac1e9473849b63b525efa1cafc050812a74e1ee (diff)
downloadcgeo-980756db69a32c6a845c51f4a229c583c6dec70f.zip
cgeo-980756db69a32c6a845c51f4a229c583c6dec70f.tar.gz
cgeo-980756db69a32c6a845c51f4a229c583c6dec70f.tar.bz2
fix: gracefully handle caches in cache list with missing fields
* have been saved with old version from not yet published cache
-rw-r--r--main/src/cgeo/geocaching/cgCacheListAdapter.java10
1 files changed, 8 insertions, 2 deletions
diff --git a/main/src/cgeo/geocaching/cgCacheListAdapter.java b/main/src/cgeo/geocaching/cgCacheListAdapter.java
index bc82369..faf4e44 100644
--- a/main/src/cgeo/geocaching/cgCacheListAdapter.java
+++ b/main/src/cgeo/geocaching/cgCacheListAdapter.java
@@ -486,8 +486,14 @@ public class cgCacheListAdapter extends ArrayAdapter<cgCache> {
holder.distance.clear();
final Bitmap dirImgPre = BitmapFactory.decodeFile(cgDirectionImg.getDirectionFile(cache.geocode).getPath());
- final Bitmap dirImg = dirImgPre.copy(Bitmap.Config.ARGB_8888, true);
- dirImgPre.recycle();
+ final Bitmap dirImg;
+ if (dirImgPre != null) { // null happens for invalid caches (not yet released)
+ dirImg = dirImgPre.copy(Bitmap.Config.ARGB_8888, true);
+ dirImgPre.recycle();
+ }
+ else {
+ dirImg = null;
+ }
if (dirImg != null) {
if (!Settings.isLightSkin()) {