commit 615e27c1de35d89e144898403007224c6f8f3707 parent 660b7cc8b7cfd0d86ad223fa50f2347acd20b5f1 Author: kernelkind <kernelkind@gmail.com> Date: Tue, 25 Feb 2025 17:48:03 -0500 fix mention crash closes: https://github.com/damus-io/notedeck/issues/747 Signed-off-by: kernelkind <kernelkind@gmail.com> Diffstat:
M | crates/notedeck_columns/src/post.rs | | | 8 | ++++++-- |
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/crates/notedeck_columns/src/post.rs b/crates/notedeck_columns/src/post.rs @@ -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); + } } } }