From 276685b919eb653bd48d96341f0e2c2b2e4ca73b Mon Sep 17 00:00:00 2001 From: StarToaster <startoaster23@gmail.com> Date: Sun, 30 Oct 2022 13:52:11 -0400 Subject: [PATCH] Fixed some errors when no nodes were present in the tree. --- examples/hello_world.rs | 1 + src/context.rs | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/examples/hello_world.rs b/examples/hello_world.rs index 759faea..87cc694 100644 --- a/examples/hello_world.rs +++ b/examples/hello_world.rs @@ -17,6 +17,7 @@ fn startup( <TextWidgetBundle text={TextProps { content: "Hello World".into(), + size: 20.0, ..Default::default() }} /> diff --git a/src/context.rs b/src/context.rs index 4096dc8..85c4c85 100644 --- a/src/context.rs +++ b/src/context.rs @@ -387,7 +387,9 @@ fn update_widgets_sys(world: &mut World) { let current = focus_tree.current(); focus_tree.clear(); if let Ok(tree) = context.tree.read() { - focus_tree.add(tree.root_node.unwrap(), &tree); + if let Some(root_node) = tree.root_node { + focus_tree.add(root_node, &tree); + } } current } else { -- GitLab