Merge pull request #30 from storytold/pr/never-crash-engine

Never crash: engine without expect() (job polling, commands, menus)
This commit is contained in:
Brandon Thomas
2026-10-04 15:31:40 -04:00
committed by GitHub
17 changed files with 53 additions and 48 deletions
+7 -1
View File
@@ -196,7 +196,13 @@ pub fn top_level() -> Vec<&'static str> {
/// The menu bar for this platform.
pub fn menu_bar() -> &'static [MenuNode] {
static BAR: OnceLock<Vec<MenuNode>> = OnceLock::new();
BAR.get_or_init(|| parse(TREE, cfg!(target_os = "macos")).expect("menu tree parses"))
BAR.get_or_init(|| {
// The tree is a constant (a test parses it on every platform); never panic over it.
parse(TREE, cfg!(target_os = "macos")).unwrap_or_else(|e| {
log::error!("menu tree: {e}");
Vec::new()
})
})
}
/// Every entry with its submenu path (`["Layer", "Blending Mode"]`), depth first.