Add null check in tryMarkingPostAsRead() in ViewPostDetailFragment.

This commit is contained in:
Alex Ning 2021-09-23 20:18:07 +08:00
parent 5f4ecbbe88
commit 3482ab36e9

View File

@ -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));