diff options
author | Bananeweizen <bananeweizen@gmx.de> | 2012-05-31 22:14:47 +0200 |
---|---|---|
committer | Samuel Tardieu <sam@rfc1149.net> | 2012-06-01 10:22:25 +0200 |
commit | 62bf51b80b24970cb482484fee291d239ec88d14 (patch) | |
tree | 781fb00194cf7838d6db506b9441fe7fa58af8a2 /main/src | |
parent | 39d0980a9651130033437011b0451e09794e3cbe (diff) | |
download | cgeo-62bf51b80b24970cb482484fee291d239ec88d14.zip cgeo-62bf51b80b24970cb482484fee291d239ec88d14.tar.gz cgeo-62bf51b80b24970cb482484fee291d239ec88d14.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 3af770e..9d6c9d8 100644 --- a/main/src/cgeo/geocaching/cgeocaches.java +++ b/main/src/cgeo/geocaching/cgeocaches.java @@ -478,15 +478,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); @@ -623,11 +625,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)) |