fix(context_menu): don't panic when no menu is set
This commit is contained in:
parent
0304f1d92e
commit
37c392a470
1 changed files with 5 additions and 3 deletions
|
|
@ -269,9 +269,11 @@ impl<Message: 'static + Clone> Widget<Message, crate::Theme, crate::Renderer>
|
||||||
fn diff(&mut self, tree: &mut Tree) {
|
fn diff(&mut self, tree: &mut Tree) {
|
||||||
tree.diff_children(std::slice::from_mut(&mut self.content));
|
tree.diff_children(std::slice::from_mut(&mut self.content));
|
||||||
let state = tree.state.downcast_mut::<LocalState>();
|
let state = tree.state.downcast_mut::<LocalState>();
|
||||||
state.menu_bar_state.inner.with_data_mut(|inner| {
|
if let Some(context_menu) = self.context_menu.as_mut() {
|
||||||
menu_roots_diff(self.context_menu.as_mut().unwrap(), &mut inner.tree);
|
state.menu_bar_state.inner.with_data_mut(|inner| {
|
||||||
});
|
menu_roots_diff(context_menu, &mut inner.tree);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// if let Some(ref mut context_menus) = self.context_menu {
|
// if let Some(ref mut context_menus) = self.context_menu {
|
||||||
// for (menu, tree) in context_menus
|
// for (menu, tree) in context_menus
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue