Skip to content

Commit

Permalink
Fix unexpected argument panic in pest_debugger (#740)
Browse files Browse the repository at this point in the history
  • Loading branch information
dffdff2423 committed Nov 25, 2022
1 parent 8c602d8 commit 0217ff2
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion debugger/src/main.rs
Expand Up @@ -198,6 +198,7 @@ impl Default for CliArgs {
};
let args = std::env::args();
let mut iter = args.skip(1);
let mut unexpected_arg = false;
while let Some(arg) = iter.next() {
match arg.as_str() {
"-g" | "--grammar" => {
Expand Down Expand Up @@ -256,9 +257,15 @@ impl Default for CliArgs {
);
std::process::exit(0);
}
_ => unreachable!(),
arg => {
eprintln!("Error: unexpected argument `{}`", arg);
unexpected_arg = true;
}
}
}
if unexpected_arg {
std::process::exit(1);
}
result
}
}
Expand Down

0 comments on commit 0217ff2

Please sign in to comment.