diff options
author | Bananeweizen <bananeweizen@gmx.de> | 2014-12-26 10:57:32 +0100 |
---|---|---|
committer | Bananeweizen <bananeweizen@gmx.de> | 2014-12-26 10:57:32 +0100 |
commit | a4deb343a3d2ad3a3f13e80c418f735682f1907d (patch) | |
tree | 95e2fe82349de11804b8c300a20d2eefe44d6b04 /main | |
parent | 5ff59d2ec61adeabf9febcdc20a3fd9e600b57e4 (diff) | |
download | cgeo-a4deb343a3d2ad3a3f13e80c418f735682f1907d.zip cgeo-a4deb343a3d2ad3a3f13e80c418f735682f1907d.tar.gz cgeo-a4deb343a3d2ad3a3f13e80c418f735682f1907d.tar.bz2 |
fix #4558: NPE in TrackableActivity
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(); + } } } |