mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-12 05:15:00 +00:00
Avoid panic in OutlineView when active item isn't an editor
This commit is contained in:
parent
b7561c6cef
commit
5de5e4b6f2
1 changed files with 17 additions and 18 deletions
|
@ -162,12 +162,10 @@ impl OutlineView {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn toggle(workspace: &mut Workspace, _: &Toggle, cx: &mut ViewContext<Workspace>) {
|
fn toggle(workspace: &mut Workspace, _: &Toggle, cx: &mut ViewContext<Workspace>) {
|
||||||
let editor = workspace
|
if let Some(editor) = workspace
|
||||||
.active_item(cx)
|
.active_item(cx)
|
||||||
.unwrap()
|
.and_then(|item| item.to_any().downcast::<Editor>())
|
||||||
.to_any()
|
{
|
||||||
.downcast::<Editor>()
|
|
||||||
.unwrap();
|
|
||||||
let settings = workspace.settings();
|
let settings = workspace.settings();
|
||||||
let buffer = editor
|
let buffer = editor
|
||||||
.read(cx)
|
.read(cx)
|
||||||
|
@ -183,6 +181,7 @@ impl OutlineView {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn select_prev(&mut self, _: &SelectPrev, cx: &mut ViewContext<Self>) {
|
fn select_prev(&mut self, _: &SelectPrev, cx: &mut ViewContext<Self>) {
|
||||||
if self.selected_match_index > 0 {
|
if self.selected_match_index > 0 {
|
||||||
|
|
Loading…
Reference in a new issue