Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
fix panics (#13554)
Conrad Irwincd81dad2faad
diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rsindex 21e97ac808a..c23daf22961 100644--- a/crates/editor/src/editor.rs+++ b/crates/editor/src/editor.rs@@ -2914,6 +2914,9 @@ impl Editor {let start_offset = TO::to_offset(&range.start, &buffer_snapshot);let end_offset = start_offset + end_difference;let start_offset = start_offset + start_difference;+ if start_offset > buffer_snapshot.len() || end_offset > buffer_snapshot.len() {+ continue;+ }let start = buffer_snapshot.anchor_after(start_offset);let end = buffer_snapshot.anchor_after(end_offset);linked_editsdiff --git a/crates/project/src/project.rs b/crates/project/src/project.rsindex 9c4daac5aaa..f4b60149a70 100644--- a/crates/project/src/project.rs+++ b/crates/project/src/project.rs@@ -8192,7 +8192,7 @@ impl Project {}};- if abs_path.ends_with(local_settings_file_relative_path()) {+ if path.ends_with(local_settings_file_relative_path()) {let settings_dir = Arc::from(path.ancestors().nth(local_settings_file_relative_path().components().count())@@ -8209,7 +8209,7 @@ impl Project {},)});- } else if abs_path.ends_with(local_tasks_file_relative_path()) {+ } else if path.ends_with(local_tasks_file_relative_path()) {self.task_inventory().update(cx, |task_inventory, cx| {if removed {task_inventory.remove_local_static_source(&abs_path);@@ -8229,7 +8229,7 @@ impl Project {);}})- } else if abs_path.ends_with(local_vscode_tasks_file_relative_path()) {+ } else if path.ends_with(local_vscode_tasks_file_relative_path()) {self.task_inventory().update(cx, |task_inventory, cx| {if removed {task_inventory.remove_local_static_source(&abs_path);