From 2a9ce3cec35bff26522b7a550ff73d590a920642 Mon Sep 17 00:00:00 2001 From: Kyle Kelley Date: Mon, 15 Apr 2024 16:53:08 -0700 Subject: [PATCH] Handle no active editor available (#10503) Cleaned up a stray `.unwrap()` Release Notes: - N/A --- crates/assistant/src/assistant_panel.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/crates/assistant/src/assistant_panel.rs b/crates/assistant/src/assistant_panel.rs index a215fbc8fd70d6c8a110817cb5882c5c5ae3cd07..61c5c38d12e3f568dd7c1387920f4fcb8484ed5a 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() }, )) }