From 90bd8d18cac9a7a7fdeb07d3373e2d0ddcf95df0 Mon Sep 17 00:00:00 2001 From: Dominik Wilkowski Date: Tue, 28 Nov 2023 00:34:30 +1000 Subject: [PATCH] fixed #198 (#201) --- src/view.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/view.rs b/src/view.rs index bae09ecc..8ba24391 100644 --- a/src/view.rs +++ b/src/view.rs @@ -571,7 +571,12 @@ fn view_tree_previous(root_view: &dyn View, id: &Id) -> Option { view_previous_sibling(root_view, id_path.dispatch()) .map(|view| view_nested_last_child(view).id()) - .or_else(|| (root_view.id() != *id).then_some(id.parent().unwrap())) + .or_else(|| { + (root_view.id() != *id).then_some( + id.parent() + .unwrap_or_else(|| view_nested_last_child(root_view).id()), + ) + }) } /// Get the id of the view before this one (but with the same parent and level of nesting)