fix: dont panc

This commit is contained in:
Jonathan Kelley 2022-12-14 08:51:28 -08:00
parent e4d089fabc
commit c90be6bdc5

View file

@ -95,7 +95,11 @@ impl VirtualDom {
fn drop_scope_inner(&mut self, node: &VNode) {
node.clear_listeners();
node.dynamic_nodes.iter().for_each(|node| match node {
DynamicNode::Component(c) => self.drop_scope(c.scope.get().unwrap()),
DynamicNode::Component(c) => {
if let Some(f) = c.scope.get() {
self.drop_scope(f)
}
}
DynamicNode::Fragment(nodes) => {
nodes.iter().for_each(|node| self.drop_scope_inner(node))
}