From 4d92b7e18c42f539d641807f4304f41a5efa8ac0 Mon Sep 17 00:00:00 2001 From: Samuel Tardieu Date: Wed, 27 Mar 2013 22:08:42 +0100 Subject: 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. --- main/src/cgeo/geocaching/cgeocaches.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'main/src') 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(); } -- cgit v1.1