diff options
| author | Bananeweizen <bananeweizen@gmx.de> | 2011-10-24 20:50:13 +0200 |
|---|---|---|
| committer | Bananeweizen <bananeweizen@gmx.de> | 2011-10-24 20:50:13 +0200 |
| commit | 980756db69a32c6a845c51f4a229c583c6dec70f (patch) | |
| tree | 5efe848b6da49ce6a87422524c1f2fdbf800a0b2 | |
| parent | aac1e9473849b63b525efa1cafc050812a74e1ee (diff) | |
| download | cgeo-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.java | 10 |
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()) { |
