From 2c9ffbc6142f63b72a1b53f24d2100d9d0d63751 Mon Sep 17 00:00:00 2001 From: Sergei Kozelko Date: Tue, 8 Nov 2022 12:53:39 +0700 Subject: [PATCH] Fix getting comment for "continue thread" button (#1207) It used position of viewholder during binding which could get outdated by the time user clicks on the button. This would result in retrieving wrong comment or even null. Replaced with getting comment based on current position of vieholder. --- .../infinityforreddit/adapters/CommentsRecyclerViewAdapter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsRecyclerViewAdapter.java index e28a579a..1dc57835 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsRecyclerViewAdapter.java @@ -780,7 +780,7 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter { - Comment comment = getCurrentComment(position); + Comment comment = getCurrentComment(holder); if (comment != null) { Intent intent = new Intent(mActivity, ViewPostDetailActivity.class); intent.putExtra(ViewPostDetailActivity.EXTRA_POST_DATA, mPost);