diff options
| author | Samuel Tardieu <sam@rfc1149.net> | 2013-03-27 22:08:42 +0100 |
|---|---|---|
| committer | Samuel Tardieu <sam@rfc1149.net> | 2013-03-27 22:08:42 +0100 |
| commit | 4d92b7e18c42f539d641807f4304f41a5efa8ac0 (patch) | |
| tree | a9ace71c84faf96127b08e912f8181ac09d9da21 | |
| parent | d5f402150fa85c6acb4d46b15b2b3eca6f70edc8 (diff) | |
| download | cgeo-4d92b7e18c42f539d641807f4304f41a5efa8ac0.zip cgeo-4d92b7e18c42f539d641807f4304f41a5efa8ac0.tar.gz cgeo-4d92b7e18c42f539d641807f4304f41a5efa8ac0.tar.bz2 | |
fix #2602: crash on "show on list" from live map
The pseudo loader created by onCreate() when coming from the live map
uses the adapter before it is created.
Here we invert the order of creation while checking for onCreateLoader()
returning null which is the case when coming from a map.
| -rw-r--r-- | main/src/cgeo/geocaching/cgeocaches.java | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/main/src/cgeo/geocaching/cgeocaches.java b/main/src/cgeo/geocaching/cgeocaches.java index d29b924..df09936 100644 --- a/main/src/cgeo/geocaching/cgeocaches.java +++ b/main/src/cgeo/geocaching/cgeocaches.java @@ -439,23 +439,23 @@ public class cgeocaches extends AbstractListActivity implements FilteredActivity } } + setTitle(title); + setAdapter(); + + prepareFilterBar(); + currentLoader = (AbstractSearchLoader) getSupportLoaderManager().initLoader(type.ordinal(), extras, this); // init if (CollectionUtils.isNotEmpty(cacheList)) { - if (currentLoader.isStarted()) { + // currentLoader can be null if this activity is created from a map, as onCreateLoader() will return null. + if (currentLoader != null && currentLoader.isStarted()) { showFooterLoadingCaches(); - } - else { + } else { showFooterMoreCaches(); } } - setTitle(title); - setAdapter(); - - prepareFilterBar(); - if (isInvokedFromAttachment()) { importGpxAttachement(); } |
