Skip to content

Commit

Permalink
Fix an NPE in comment parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
gzsombor committed Apr 6, 2024
1 parent 552f351 commit 8d81303
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import com.mikepenz.iconics.typeface.library.materialdesigniconic.MaterialDesignIconic;

import org.schabi.newpipe.extractor.comments.CommentsInfoItem;
import org.schabi.newpipe.extractor.stream.Description;

import java.util.ArrayList;
import java.util.HashMap;
Expand Down Expand Up @@ -276,7 +277,7 @@ protected void updateInfo(final CommentsInfoItem comment, boolean isTopLevelComm
binding.commentPaddingView.setVisibility(isTopLevelComment ? View.GONE : View.VISIBLE);
binding.authorTextView.setText(comment.getUploaderName());
Linker.configure(binding.commentTextView, currentActivity);
Linker.setTextAndLinkify(binding.commentTextView, comment.getCommentText().getContent());
Linker.setTextAndLinkify(binding.commentTextView, getCommentText(comment));
binding.commentDateTextView.setText(comment.getTextualUploadDate());
binding.commentUpvotesTextView.setText(String.valueOf(comment.getLikeCount()));
Glide.with(context)
Expand Down Expand Up @@ -313,6 +314,11 @@ protected void updateInfo(final CommentsInfoItem comment, boolean isTopLevelComm
}
}

private static String getCommentText(CommentsInfoItem infoItem) {
Description description = infoItem.getCommentText();
return description != null ? description.getContent() : "";
}

////////////////////////////////////////////////////////////////////////////////////////////////

private class GetReplies extends AsyncTaskParallel<CommentsInfoItem, Void, List<String>> {
Expand Down

0 comments on commit 8d81303

Please sign in to comment.