mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-12 21:32:40 +00:00
fix go to line panic by replacing an unwrap with an and_then
This commit is contained in:
parent
40a4c18ee4
commit
72188456b2
1 changed files with 3 additions and 1 deletions
|
@ -59,7 +59,9 @@ impl GoToLine {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn toggle(workspace: &mut Workspace, _: &Toggle, cx: &mut ViewContext<Workspace>) {
|
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, _| {
|
workspace.toggle_modal(cx, |cx, _| {
|
||||||
let view = cx.add_view(|cx| GoToLine::new(editor, cx));
|
let view = cx.add_view(|cx| GoToLine::new(editor, cx));
|
||||||
cx.subscribe(&view, Self::on_event).detach();
|
cx.subscribe(&view, Self::on_event).detach();
|
||||||
|
|
Loading…
Reference in a new issue