mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-10 05:37:29 +03:00
Merge pull request #630 from zed-industries/fix/go-to-line-panic
Fix go to line panic by replacing an unwrap with an and_then
This commit is contained in:
commit
a0224cbe71
@ -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