list editor: catch out of bounds in ListEditor::get_item()
This commit is contained in:
parent
7fdc0bf272
commit
2fd209c502
2 changed files with 8 additions and 2 deletions
nested/src/list
|
@ -698,7 +698,11 @@ where ItemEditor: TerminalTreeEditor + ?Sized + Send + Sync + 'static,
|
|||
|
||||
pub fn get_item(&self) -> Option<Arc<RwLock<ItemEditor>>> {
|
||||
if let Some(idx) = self.cursor.get().idx {
|
||||
Some(self.data.get(idx))
|
||||
if idx < self.data.len() {
|
||||
Some(self.data.get(idx))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue