embedded-menu icon indicating copy to clipboard operation
embedded-menu copied to clipboard

MenuBuilder::add_menu_items panics with "attempt to subtract with overflow" when passed an empty slice

Open RobertGauld opened this issue 3 months ago • 1 comments

let mut items = Vec::new();
let mut menu = Menu::with_style(title, style.clone())
    .add_menu_items(items.as_mut_slice())
    .build();

Results in:

3.156 ERROR panicked at /home/robert/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/embedded-menu-0.6.1/src/interaction/mod.rs:56:38:
attempt to subtract with overflow
``

RobertGauld avatar Sep 09 '25 20:09 RobertGauld

Thanks for finding this. I'm not able to actively work on embedded-menu, but if you're willing to get your hands dirty, I'd be happy to merge and release a fix.

bugadani avatar Sep 09 '25 21:09 bugadani