You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] Panic when opening empty menubar subtree #776
Describe the bug
When creating a menubar with an empty subtree, panics when you select it in the menu.
Dealing with this as I want to create a dynamic menubar to select a file, although maybe this isn't the best approach.
To Reproduce
letmut siv = cursive::default();
siv.menubar().add_subtree("foo",Tree::new());
siv.add_global_callback(Key::Esc, |s| s.select_menubar());
siv.run();// Then press escape, go to foo and press enter.
Expected behavior
Expected to not panic
Environment
OS: Linux (Nobara 39)
Backend used: ncurses
Current locale: en_US
Cursive version: 0.20.0
Nightly rust in debug build
Additional context
Assuming index OOB error "len is 0 but index is 0":
Activity
gyscos commentedon Mar 27, 2024
Thanks for the report!
Indeed, not panicking sounds like a better behavior :)
correabuscar commentedon Jun 11, 2024
Tentative fix would be:
But maybe this isn't the proper way to do it. Like, some indirection(via some new function) might be wanted instead.
tentatively fixes gyscos#776
tentatively fixes gyscos#776