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.

Handle no active editor available (#10503)

Kyle Kelley2a9ce3cec35b
diff --git a/crates/assistant/src/assistant_panel.rs b/crates/assistant/src/assistant_panel.rs
index a215fbc8fd7..61c5c38d12e 100644
--- a/crates/assistant/src/assistant_panel.rs
+++ b/crates/assistant/src/assistant_panel.rs
@@ -1119,8 +1119,8 @@ impl AssistantPanel {
)
.size_full()
.into_any_element()
- } else {
- let editor = self.active_conversation_editor().unwrap();
+ } else if let Some(editor) = self.active_conversation_editor() {
+ let editor = editor.clone();
let conversation = editor.read(cx).conversation.clone();
div()
.size_full()
@@ -1135,6 +1135,8 @@ impl AssistantPanel {
.children(self.render_remaining_tokens(&conversation, cx)),
)
.into_any_element()
+ } else {
+ div().into_any_element()
},
))
}