diff options
| author | Bananeweizen <bananeweizen@gmx.de> | 2012-05-31 22:14:47 +0200 |
|---|---|---|
| committer | Bananeweizen <bananeweizen@gmx.de> | 2012-05-31 22:14:47 +0200 |
| commit | 62636e394a954309899604be1222a5e1a984390b (patch) | |
| tree | e906a7ef07ce9902b805bfe54d8595c73ce41f21 /main/src | |
| parent | 1e9a9696924a73409ac9dd3c83798b0bf54f97c0 (diff) | |
| download | cgeo-62636e394a954309899604be1222a5e1a984390b.zip cgeo-62636e394a954309899604be1222a5e1a984390b.tar.gz cgeo-62636e394a954309899604be1222a5e1a984390b.tar.bz2 | |
fix #1694: crash on import from mail
Diffstat (limited to 'main/src')
| -rw-r--r-- | main/src/cgeo/geocaching/cgeocaches.java | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/main/src/cgeo/geocaching/cgeocaches.java b/main/src/cgeo/geocaching/cgeocaches.java index fffd8bb..9208fef 100644 --- a/main/src/cgeo/geocaching/cgeocaches.java +++ b/main/src/cgeo/geocaching/cgeocaches.java @@ -428,15 +428,17 @@ public class cgeocaches extends AbstractListActivity { setTitle("caches"); // get parameters - final Bundle extras = getIntent().getExtras(); - if (extras == null) { - throw new UnsupportedOperationException(); // shall not happen, as we always set the extras when invoking the activity + Bundle extras = getIntent().getExtras(); + if (extras != null) { + Object typeObject = extras.get(EXTRAS_LIST_TYPE); + type = (typeObject instanceof CacheListType) ? (CacheListType) typeObject : CacheListType.OFFLINE; + coords = (Geopoint) extras.getParcelable(EXTRAS_COORDS); + } + else { + extras = new Bundle(); } - Object typeObject = extras.get(EXTRAS_LIST_TYPE); - type = (typeObject instanceof CacheListType) ? (CacheListType) typeObject : CacheListType.OFFLINE; - coords = (Geopoint) extras.getParcelable(EXTRAS_COORDS); cacheType = Settings.getCacheType(); - if (Intent.ACTION_VIEW.equals(getIntent().getAction())) { + if (isInvokedFromAttachment()) { type = CacheListType.OFFLINE; if (coords == null) { coords = new Geopoint(0.0, 0.0); @@ -573,11 +575,15 @@ public class cgeocaches extends AbstractListActivity { } prepareFilterBar(); - if (Intent.ACTION_VIEW.equals(getIntent().getAction())) { + if (isInvokedFromAttachment()) { importGpxAttachement(); } } + private boolean isInvokedFromAttachment() { + return Intent.ACTION_VIEW.equals(getIntent().getAction()); + } + private void importGpxAttachement() { new AlertDialog.Builder(this) .setTitle(res.getString(R.string.gpx_import_title)) |
