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.

Fix panic in copilot (#50056)

Conrad Irwinc9dc794786b1
diff --git a/crates/copilot/src/copilot.rs b/crates/copilot/src/copilot.rs
index a1bbc26b9c4..179e217d207 100644
--- a/crates/copilot/src/copilot.rs
+++ b/crates/copilot/src/copilot.rs
@@ -1035,10 +1035,9 @@ impl Copilot {
};
let buffer_entity = buffer.clone();
let lsp = server.lsp.clone();
- let registered_buffer = server
- .registered_buffers
- .get_mut(&buffer.entity_id())
- .unwrap();
+ let Some(registered_buffer) = server.registered_buffers.get_mut(&buffer.entity_id()) else {
+ return Task::ready(Err(anyhow::anyhow!("buffer not registered")));
+ };
let pending_snapshot = registered_buffer.report_changes(buffer, cx);
let buffer = buffer.read(cx);
let uri = registered_buffer.uri.clone();