-
Notifications
You must be signed in to change notification settings - Fork 39
Open
Labels
Description
I build this code as binary file.
extern crate argparse;
use argparse::{ArgumentParser, Store, StoreTrue};
fn main() -> std::io::Result<()> {
let mut write_filename = String::new();
let mut tty_device = String::new();
{
let mut ap = ArgumentParser::new();
ap.refer(&mut tty_device)
.add_option(&[], Store, "tty device")
.required();
ap.parse_args_or_exit();
}
Ok(())
}I called my_bin and got panic:
./target/debug/my_bin
thread 'main' panicked at 'index out of bounds: the len is 0 but the index is 0', /home/pc/.cargo/registry/src/github.202132.xyz-1ecc6299db9ec823/argparse-0.2.1/src/parser.rs:517:40
note: Run with `RUST_BACKTRACE=1` for a backtrace.
Process exited with code 101.
I think the problem is contained on this line:
.add_option(&[], Store, "tty device")