diff options
| author | Samuel Tardieu <sam@rfc1149.net> | 2014-01-02 11:51:52 +0100 |
|---|---|---|
| committer | Samuel Tardieu <sam@rfc1149.net> | 2014-01-02 11:51:52 +0100 |
| commit | 72c96930b900a9807373e2744658fd792ee13a52 (patch) | |
| tree | 9e8cd9a54908c1b5c5cdc9435f2bd9dc68309f47 /main | |
| parent | fdbdf6495b06acb58482c6d3aa5da9ef57514493 (diff) | |
| download | cgeo-72c96930b900a9807373e2744658fd792ee13a52.zip cgeo-72c96930b900a9807373e2744658fd792ee13a52.tar.gz cgeo-72c96930b900a9807373e2744658fd792ee13a52.tar.bz2 | |
Return a concrete list when returning cache logs
Diffstat (limited to 'main')
| -rw-r--r-- | main/src/cgeo/geocaching/Geocache.java | 7 |
1 files changed, 5 insertions, 2 deletions
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<Image> spoilers = null; - private final List<LogEntry> logs = new LazyInitializedList<LogEntry>() { + private final LazyInitializedList<LogEntry> logs = new LazyInitializedList<LogEntry>() { @Override public List<LogEntry> call() { return DataStore.loadLogs(geocode); @@ -1022,7 +1022,10 @@ public class Geocache implements ICache, IWaypoint { * @return never <code>null</code> */ public List<LogEntry> 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(); } /** |
