diff options
author | Bananeweizen <bananeweizen@gmx.de> | 2012-04-30 16:04:44 +0200 |
---|---|---|
committer | Bananeweizen <bananeweizen@gmx.de> | 2012-04-30 16:04:44 +0200 |
commit | 58112d3bac3f5097eaaf9733f25dacea0e1fc43b (patch) | |
tree | 3ee6368802f95ce2c758fe0f2ff8897f7a305834 | |
parent | b4f9590734745720af5325b209c2d913e5258ea8 (diff) | |
download | cgeo-58112d3bac3f5097eaaf9733f25dacea0e1fc43b.zip cgeo-58112d3bac3f5097eaaf9733f25dacea0e1fc43b.tar.gz cgeo-58112d3bac3f5097eaaf9733f25dacea0e1fc43b.tar.bz2 |
avoid potential NPE introduced with
029f40a82f939bee3ad6b6ec00ced6c4f40044b9
-rw-r--r-- | main/src/cgeo/geocaching/cgeocaches.java | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/main/src/cgeo/geocaching/cgeocaches.java b/main/src/cgeo/geocaching/cgeocaches.java index c47a338..8d22483 100644 --- a/main/src/cgeo/geocaching/cgeocaches.java +++ b/main/src/cgeo/geocaching/cgeocaches.java @@ -1070,6 +1070,11 @@ public class cgeocaches extends AbstractListActivity implements IObserver<Object final cgCache cache = adapterInfo != null ? getCacheFromAdapter(adapterInfo) : null; + // just in case the list got resorted while we are executing this code + if (cache == null) { + return true; + } + final int id = item.getItemId(); switch (id) { case MENU_DEFAULT_NAVIGATION: @@ -1115,10 +1120,8 @@ public class cgeocaches extends AbstractListActivity implements IObserver<Object // in Android: // https://code.google.com/p/android/issues/detail?id=7139 lastMenuInfo = info; - if (cache != null) { - // create a search for a single cache (as if in details view) - cache.logOffline(this, LogType.getById(id - MENU_LOG_VISIT_OFFLINE)); - } + // create a search for a single cache (as if in details view) + cache.logOffline(this, LogType.getById(id - MENU_LOG_VISIT_OFFLINE)); } return true; |