Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

rope: Fix an unintentional panic (#47019)

Marco Mihai Condrache1ca52793ff9c
diff --git a/crates/rope/src/chunk.rs b/crates/rope/src/chunk.rs
index 69553eafb1b..49bc8846217 100644
--- a/crates/rope/src/chunk.rs
+++ b/crates/rope/src/chunk.rs
@@ -721,7 +721,7 @@ fn panic_char_boundary(text: &str, offset: usize) -> ! {
#[inline(never)]
#[track_caller]
fn log_err_char_boundary(text: &str, offset: usize) {
- if offset > text.len() {
+ if offset >= text.len() {
log::error!(
"byte index {} is out of bounds of `{:?}` (length: {})",
offset,