fix mention crash

closes: https://github.com/damus-io/notedeck/issues/747

Signed-off-by: kernelkind <kernelkind@gmail.com>
This commit is contained in:
kernelkind
2025-02-25 17:48:03 -05:00
parent 660b7cc8b7
commit 615e27c1de

View File

@@ -341,8 +341,12 @@ impl PostBuffer {
if let Some(info) = self.mentions.get(mention_ind) {
if let MentionType::Finalized(pk) = info.mention_type {
if let Some(bech) = pk.to_bech() {
out.replace_range(info.start_index..*cur_end_ind, &format!("nostr:{bech}"));
mentions.push(pk);
if let Some(byte_range) =
char_indices_to_byte(&out, info.start_index..*cur_end_ind)
{
out.replace_range(byte_range, &format!("nostr:{bech}"));
mentions.push(pk);
}
}
}
}