Skip to content

Commit

Permalink
fix(HtmlParser): check if hashtag has text
Browse files Browse the repository at this point in the history
Fixes a crash, where the text of an hashtag was empty, leading to an oob
string access.
  • Loading branch information
FineFindus committed Aug 31, 2024
1 parent c2e6280 commit 7fa079e
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public void head(@NonNull Node node, int depth){
String href=el.attr("href");
LinkSpan.Type linkType;
String text=el.text();
if(el.hasClass("hashtag") || text.startsWith("#")){
if(!TextUtils.isEmpty(text) && (el.hasClass("hashtag") || text.startsWith("#"))){
// MOSHIDON: we have slightly refactored this so that the hashtags properly work in akkoma
// TODO: upstream this
linkType=LinkSpan.Type.HASHTAG;
Expand Down

0 comments on commit 7fa079e

Please sign in to comment.