diff --git a/mastodon/src/main/java/org/joinmastodon/android/ui/text/HtmlParser.java b/mastodon/src/main/java/org/joinmastodon/android/ui/text/HtmlParser.java index ec3757dd..a27ced1d 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/ui/text/HtmlParser.java +++ b/mastodon/src/main/java/org/joinmastodon/android/ui/text/HtmlParser.java @@ -129,7 +129,16 @@ public class HtmlParser{ } public static void parseCustomEmoji(SpannableStringBuilder ssb, List emojis){ - Map emojiByCode=emojis.stream().collect(Collectors.toMap(e->e.shortcode, Function.identity())); + Map emojiByCode = + emojis.stream() + .collect( + Collectors.toMap(e->e.shortcode, Function.identity(), (emoji1, emoji2) -> { + // Ignore duplicate shortcodes and just take the first, it will be + // the same emoji anyway + return emoji1; + }) + ); + Matcher matcher=EMOJI_CODE_PATTERN.matcher(ssb); int spanCount=0; CustomEmojiSpan lastSpan=null;