From 3b17f19be0e0e4add79784c6b550d16ff4366f2c Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Tue, 13 Aug 2024 09:14:28 +0000 Subject: [PATCH] core: Do not panic when popups try to find their parent Popups may have normal `Item`s as parrent, while all the other components always have a `DynamicTree` as a parent. So do not panic when some component ends up with an `Item` as a parent. Just return `None` instead of panicing. We probably need to make the focus-handling more aware of popups eventually, but this stops the panics. Fixes: #5826, #5830 --- internal/core/item_tree.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/core/item_tree.rs b/internal/core/item_tree.rs index f9f7bbae4d8..24892f88dd4 100644 --- a/internal/core/item_tree.rs +++ b/internal/core/item_tree.rs @@ -527,7 +527,8 @@ impl ItemRc { let subtree_index = match parent_item_tree.get(parent_item_index)? { crate::item_tree::ItemTreeNode::Item { .. } => { - panic!("Got an Item, expected a repeater!") + // Popups can trigger this case! + return None; } crate::item_tree::ItemTreeNode::DynamicTree { index, .. } => *index, };