diff --git a/crates/go_to_line/src/go_to_line.rs b/crates/go_to_line/src/go_to_line.rs index 0f21f268e1..50bae39ae9 100644 --- a/crates/go_to_line/src/go_to_line.rs +++ b/crates/go_to_line/src/go_to_line.rs @@ -59,7 +59,9 @@ impl GoToLine { } fn toggle(workspace: &mut Workspace, _: &Toggle, cx: &mut ViewContext) { - if let Some(editor) = workspace.active_item(cx).unwrap().downcast::() { + if let Some(editor) = workspace.active_item(cx) + .and_then(|active_item| active_item.downcast::()) + { workspace.toggle_modal(cx, |cx, _| { let view = cx.add_view(|cx| GoToLine::new(editor, cx)); cx.subscribe(&view, Self::on_event).detach();