From 3482ab36e9954be164e9ee4ae88ff188bb636100 Mon Sep 17 00:00:00 2001 From: Alex Ning Date: Thu, 23 Sep 2021 20:18:07 +0800 Subject: Add null check in tryMarkingPostAsRead() in ViewPostDetailFragment. --- .../infinityforreddit/fragments/ViewPostDetailFragment.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/src/main/java/ml/docilealligator/infinityforreddit') diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewPostDetailFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewPostDetailFragment.java index 0fb79a49..e912418d 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewPostDetailFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewPostDetailFragment.java @@ -1094,7 +1094,7 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic } private void tryMarkingPostAsRead() { - if (mMarkPostsAsRead && !mPost.isRead()) { + if (mMarkPostsAsRead && mPost != null && !mPost.isRead()) { mPost.markAsRead(true); InsertReadPost.insertReadPost(mRedditDataRoomDatabase, mExecutor, mAccountName, mPost.getId()); EventBus.getDefault().post(new PostUpdateEventToPostList(mPost, postListPosition)); -- cgit v1.2.3