From cfc83acff0bf00c1a1fd083e2f4a48007e703361 Mon Sep 17 00:00:00 2001 From: "zed-zippy[bot]" <234243425+zed-zippy[bot]@users.noreply.github.com> Date: Thu, 19 Feb 2026 01:29:47 +0000 Subject: [PATCH] git: Mitigate panic in split diff (#49546) (cherry-pick to stable) (#49549) Cherry-pick of #49546 to stable ---- Release Notes: - N/A Co-authored-by: Cole Miller --- crates/editor/src/split.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/crates/editor/src/split.rs b/crates/editor/src/split.rs index 18f07f169318ad1e40123caf5b9ebcc0db2cf706..1dd382089605b77b19c218eb63b19ea1875bd911 100644 --- a/crates/editor/src/split.rs +++ b/crates/editor/src/split.rs @@ -225,10 +225,12 @@ where for (source_buffer, buffer_offset_range, source_excerpt_id, source_context_range) in source_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();