From 610379fb56406b0d4ac2b4f30f0d28dcdbb34e2e Mon Sep 17 00:00:00 2001 From: Bananeweizen Date: Wed, 4 Jan 2012 20:05:40 +0100 Subject: fix: NPE for imported caches without any log --- main/src/cgeo/geocaching/CacheDetailActivity.java | 2 +- main/src/cgeo/geocaching/cgBase.java | 2 +- main/src/cgeo/geocaching/cgCache.java | 5 ++++- 3 files changed, 6 insertions(+), 3 deletions(-) (limited to 'main/src') diff --git a/main/src/cgeo/geocaching/CacheDetailActivity.java b/main/src/cgeo/geocaching/CacheDetailActivity.java index 7cb33af..602f340 100644 --- a/main/src/cgeo/geocaching/CacheDetailActivity.java +++ b/main/src/cgeo/geocaching/CacheDetailActivity.java @@ -2204,7 +2204,7 @@ public class CacheDetailActivity extends AbstractActivity { // cache logs RelativeLayout rowView; - if (cache != null && cache.getLogs(allLogs) != null) { + if (cache != null) { for (cgLog log : cache.getLogs(allLogs)) { rowView = (RelativeLayout) getLayoutInflater().inflate(R.layout.cacheview_logs_item, null); diff --git a/main/src/cgeo/geocaching/cgBase.java b/main/src/cgeo/geocaching/cgBase.java index 9097e75..273b36b 100644 --- a/main/src/cgeo/geocaching/cgBase.java +++ b/main/src/cgeo/geocaching/cgBase.java @@ -2674,7 +2674,7 @@ public class cgBase { } // store images from logs - if (Settings.isStoreLogImages() && cache.getLogs(true) != null) { + if (Settings.isStoreLogImages()) { for (cgLog log : cache.getLogs(true)) { if (CollectionUtils.isNotEmpty(log.logImages)) { for (cgImage oneLogImg : log.logImages) { diff --git a/main/src/cgeo/geocaching/cgCache.java b/main/src/cgeo/geocaching/cgCache.java index 92023e5..2f9f09c 100644 --- a/main/src/cgeo/geocaching/cgCache.java +++ b/main/src/cgeo/geocaching/cgCache.java @@ -804,9 +804,12 @@ public class cgCache implements ICache { /** * @param allLogs * true for all logs, false for friend logs only - * @return the logs with all entries or just the entries of the friends + * @return the logs with all entries or just the entries of the friends, never null */ public List getLogs(boolean allLogs) { + if (logs == null) { + return Collections.emptyList(); + } if (allLogs) { return logs; } -- cgit v1.1