fix: panic! during parsing
Typing `selector -qa` into nu would cause a `panic!`
This was the case because the inner loop incremented the `idx`
that was only checked in the outer loop and used it to index into
`lite_cmd.parts[idx]`
With the fix we now break loop.
@@ -1559,12 +1559,17 @@ fn parse_internal_command(
if error.is_none() {
error = err;
}
- } else if error.is_none() {
+ } else {
+ if error.is_none() {
error = Some(ParseError::argument_error(
lite_cmd.parts[0].clone(),
- ArgumentError::MissingValueForName(full_name.to_owned()),
+ ArgumentError::MissingValueForName(
+ full_name.to_owned(),
+ ),
));
}
+ break;
+ }
}
}
NamedType::Switch(_) => {
