From 72c96930b900a9807373e2744658fd792ee13a52 Mon Sep 17 00:00:00 2001 From: Samuel Tardieu Date: Thu, 2 Jan 2014 11:51:52 +0100 Subject: Return a concrete list when returning cache logs --- main/src/cgeo/geocaching/Geocache.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'main/src') diff --git a/main/src/cgeo/geocaching/Geocache.java b/main/src/cgeo/geocaching/Geocache.java index d4114bd..ee2e411 100644 --- a/main/src/cgeo/geocaching/Geocache.java +++ b/main/src/cgeo/geocaching/Geocache.java @@ -130,7 +130,7 @@ public class Geocache implements ICache, IWaypoint { } }; private List spoilers = null; - private final List logs = new LazyInitializedList() { + private final LazyInitializedList logs = new LazyInitializedList() { @Override public List call() { return DataStore.loadLogs(geocode); @@ -1022,7 +1022,10 @@ public class Geocache implements ICache, IWaypoint { * @return never null */ public List getLogs() { - return logs; + // It is important to return the underlying list here and not the lazily initialized one, + // because database manipulation may erase the existing logs before methods are called + // on the previous logs, when updating the saved logs for example. + return logs.getUnderlyingList(); } /** -- cgit v1.1