diff options
author | rsudev <rasch@munin-soft.de> | 2012-11-24 21:16:22 +0100 |
---|---|---|
committer | rsudev <rasch@munin-soft.de> | 2012-11-24 21:16:22 +0100 |
commit | 09efdfb6039e023cce1df0fc036803df092fbacd (patch) | |
tree | 5d8420935417482879354f526193ef4ca10e1ee7 /main/src | |
parent | b4b34451c6b42117524abb8e11dbdaae1355be57 (diff) | |
download | cgeo-09efdfb6039e023cce1df0fc036803df092fbacd.zip cgeo-09efdfb6039e023cce1df0fc036803df092fbacd.tar.gz cgeo-09efdfb6039e023cce1df0fc036803df092fbacd.tar.bz2 |
Fixes #2199
- Ensures 'not null' for trackable logs
- Ensures loadLogs never returns null, only empty List<>
- Three test-cases, surfacing the initial bug and the aspects of the fix
Diffstat (limited to 'main/src')
-rw-r--r-- | main/src/cgeo/geocaching/cgData.java | 6 | ||||
-rw-r--r-- | main/src/cgeo/geocaching/cgTrackable.java | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/main/src/cgeo/geocaching/cgData.java b/main/src/cgeo/geocaching/cgData.java index 773f08a..b822c2b 100644 --- a/main/src/cgeo/geocaching/cgData.java +++ b/main/src/cgeo/geocaching/cgData.java @@ -1915,14 +1915,14 @@ public class cgData { } public List<LogEntry> loadLogs(String geocode) { + List<LogEntry> logs = new ArrayList<LogEntry>(); + if (StringUtils.isBlank(geocode)) { - return null; + return logs; } init(); - List<LogEntry> logs = new ArrayList<LogEntry>(); - Cursor cursor = database.rawQuery( "SELECT cg_logs._id as cg_logs_id, type, author, log, date, found, friend, " + dbTableLogImages + "._id as cg_logImages_id, log_id, title, url FROM " + dbTableLogs + " LEFT OUTER JOIN " + dbTableLogImages diff --git a/main/src/cgeo/geocaching/cgTrackable.java b/main/src/cgeo/geocaching/cgTrackable.java index c9b5623..7ed3424 100644 --- a/main/src/cgeo/geocaching/cgTrackable.java +++ b/main/src/cgeo/geocaching/cgTrackable.java @@ -191,7 +191,7 @@ public class cgTrackable implements ILogable { } public void setLogs(List<LogEntry> logs) { - this.logs = logs; + this.logs = logs != null ? logs : new ArrayList<LogEntry>(); } @Override |