Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
git: Mitigate panic in split diff (#49546)
Cole Millerd5d69369a33a
diff --git a/crates/editor/src/split.rs b/crates/editor/src/split.rsindex 8fbd264684e..5edb75a366f 100644--- a/crates/editor/src/split.rs+++ b/crates/editor/src/split.rs@@ -225,10 +225,12 @@ wherefor (source_buffer, buffer_offset_range, source_excerpt_id, source_context_range) insource_snapshot.range_to_buffer_ranges_with_context(source_bounds){- let target_excerpt_id = excerpt_map.get(&source_excerpt_id).copied().unwrap();- let target_buffer = target_snapshot- .buffer_for_excerpt(target_excerpt_id)- .unwrap();+ let Some(target_excerpt_id) = excerpt_map.get(&source_excerpt_id).copied() else {+ continue;+ };+ let Some(target_buffer) = target_snapshot.buffer_for_excerpt(target_excerpt_id) else {+ continue;+ };let buffer_id = source_buffer.remote_id();