Fix crash when parsing post with null readPostList value.

This commit is contained in:
Alex Ning 2020-12-07 21:52:51 +08:00
parent 0d232fc4b8
commit 42957a1aa2

View File

@ -568,14 +568,17 @@ public class ParsePost {
size = nPosts;
}
HashSet<ReadPost> readPostHashSet = new HashSet<>(readPostList);
HashSet<ReadPost> readPostHashSet = null;
if (readPostList != null) {
readPostHashSet = new HashSet<>(readPostList);
}
for (int i = 0; i < size; i++) {
try {
if (allData.getJSONObject(i).getString(JSONUtils.KIND_KEY).equals("t3")) {
JSONObject data = allData.getJSONObject(i).getJSONObject(JSONUtils.DATA_KEY);
Post post = parseBasicData(data);
boolean availablePost = true;
if (readPostHashSet.contains(ReadPost.convertPost(post))) {
if (readPostHashSet != null && readPostHashSet.contains(ReadPost.convertPost(post))) {
post.markAsRead();
}
if (subredditFilterList != null) {