aboutsummaryrefslogtreecommitdiff
path: root/helix-view/src/tree.rs
diff options
context:
space:
mode:
Diffstat (limited to 'helix-view/src/tree.rs')
-rw-r--r--helix-view/src/tree.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/helix-view/src/tree.rs b/helix-view/src/tree.rs
index 3ba85b56..c4474c33 100644
--- a/helix-view/src/tree.rs
+++ b/helix-view/src/tree.rs
@@ -271,12 +271,16 @@ impl Tree {
}
pub fn get(&self, index: ViewId) -> &View {
+ self.try_get(index).unwrap()
+ }
+
+ pub fn try_get(&self, index: ViewId) -> Option<&View> {
match &self.nodes[index] {
Node {
content: Content::View(view),
..
- } => view,
- _ => unreachable!(),
+ } => Some(view),
+ _ => None,
}
}