mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-08 07:35:01 +03:00
fix go to line panic by replacing an unwrap with an and_then
This commit is contained in:
parent
40a4c18ee4
commit
72188456b2
@ -59,7 +59,9 @@ impl GoToLine {
|
||||
}
|
||||
|
||||
fn toggle(workspace: &mut Workspace, _: &Toggle, cx: &mut ViewContext<Workspace>) {
|
||||
if let Some(editor) = workspace.active_item(cx).unwrap().downcast::<Editor>() {
|
||||
if let Some(editor) = workspace.active_item(cx)
|
||||
.and_then(|active_item| active_item.downcast::<Editor>())
|
||||
{
|
||||
workspace.toggle_modal(cx, |cx, _| {
|
||||
let view = cx.add_view(|cx| GoToLine::new(editor, cx));
|
||||
cx.subscribe(&view, Self::on_event).detach();
|
||||
|
Loading…
Reference in New Issue
Block a user