diff options
Diffstat (limited to 'main')
-rw-r--r-- | main/src/cgeo/geocaching/DataStore.java | 2 | ||||
-rw-r--r-- | main/src/cgeo/geocaching/TrackableActivity.java | 7 |
2 files changed, 7 insertions, 2 deletions
diff --git a/main/src/cgeo/geocaching/DataStore.java b/main/src/cgeo/geocaching/DataStore.java index fae0d38..3403f3a 100644 --- a/main/src/cgeo/geocaching/DataStore.java +++ b/main/src/cgeo/geocaching/DataStore.java @@ -28,6 +28,7 @@ import org.apache.commons.collections4.MapUtils; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.StringUtils; import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; import rx.Observable; import rx.Observable.OnSubscribe; @@ -2008,6 +2009,7 @@ public class DataStore { return trackables; } + @Nullable public static Trackable loadTrackable(final String geocode) { if (StringUtils.isBlank(geocode)) { return null; diff --git a/main/src/cgeo/geocaching/TrackableActivity.java b/main/src/cgeo/geocaching/TrackableActivity.java index a9f508c..45111f6 100644 --- a/main/src/cgeo/geocaching/TrackableActivity.java +++ b/main/src/cgeo/geocaching/TrackableActivity.java @@ -612,8 +612,11 @@ public class TrackableActivity extends AbstractViewPagerActivity<TrackableActivi // refresh the logs view after coming back from logging a trackable if (trackable != null) { final Trackable updatedTrackable = DataStore.loadTrackable(trackable.getGeocode()); - trackable.setLogs(updatedTrackable.getLogs()); - reinitializeViewPager(); + // if this activity is resumed after a long time, the trackable might be gone due to regular cleanup + if (updatedTrackable != null) { + trackable.setLogs(updatedTrackable.getLogs()); + reinitializeViewPager(); + } } } |