Skip to content
This repository was archived by the owner on Jan 21, 2024. It is now read-only.

Commit f112058

Browse files
Merge pull request #305 from the-blank-x/ryd-runonuithread
Attempt to fix crash by RYD showing dislike info while screen is being rotated
2 parents 5c4f0f4 + b26df18 commit f112058

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1528,11 +1528,18 @@ public void handleResult(@NonNull final StreamInfo info) {
15281528
new Thread(() -> {
15291529
info.setDislikeCount(ReturnYouTubeDislikeUtils.getDislikes(getContext(), info));
15301530
if (info.getDislikeCount() >= 0) {
1531+
if (activity == null) {
1532+
return;
1533+
}
15311534
activity.runOnUiThread(() -> {
1532-
binding.detailThumbsDownCountView.setText(Localization
1533-
.shortCount(activity, info.getDislikeCount()));
1534-
binding.detailThumbsDownCountView.setVisibility(View.VISIBLE);
1535-
binding.detailThumbsDownImgView.setVisibility(View.VISIBLE);
1535+
if (binding != null && binding.detailThumbsDownCountView != null) {
1536+
binding.detailThumbsDownCountView.setText(Localization
1537+
.shortCount(activity, info.getDislikeCount()));
1538+
binding.detailThumbsDownCountView.setVisibility(View.VISIBLE);
1539+
}
1540+
if (binding != null && binding.detailThumbsDownImgView != null) {
1541+
binding.detailThumbsDownImgView.setVisibility(View.VISIBLE);
1542+
}
15361543
});
15371544
}
15381545
}).start();

0 commit comments

Comments
 (0)