fix mention crash
closes: https://github.com/damus-io/notedeck/issues/747 Signed-off-by: kernelkind <kernelkind@gmail.com>
This commit is contained in:
@@ -341,12 +341,16 @@ impl PostBuffer {
|
|||||||
if let Some(info) = self.mentions.get(mention_ind) {
|
if let Some(info) = self.mentions.get(mention_ind) {
|
||||||
if let MentionType::Finalized(pk) = info.mention_type {
|
if let MentionType::Finalized(pk) = info.mention_type {
|
||||||
if let Some(bech) = pk.to_bech() {
|
if let Some(bech) = pk.to_bech() {
|
||||||
out.replace_range(info.start_index..*cur_end_ind, &format!("nostr:{bech}"));
|
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);
|
mentions.push(pk);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
mentions.reverse();
|
mentions.reverse();
|
||||||
|
|
||||||
PostOutput {
|
PostOutput {
|
||||||
|
|||||||
Reference in New Issue
Block a user