Skip to content

Commit

Permalink
Merge #575
Browse files Browse the repository at this point in the history
575: Do no panic when passed empty string as argument. closes #466 r=Emilgardis a=sudipghimire533

When parsing argument `parse()` function in `src/cli.rs`  splits the argument string without checking length which results in panic when splitting empty string.
This PR pix that issue by introducing `continue` on empty string.

Co-authored-by: Sudip Ghimire <[email protected]>
  • Loading branch information
bors[bot] and sudipghimire533 committed Jul 30, 2021
2 parents dc2e724 + e73c465 commit 8ea5d46
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ pub fn parse(target_list: &TargetList) -> Args {
{
let mut args = env::args().skip(1);
while let Some(arg) = args.next() {
if arg.is_empty() {
continue;
}
if let ("+", ch) = arg.split_at(1) {
channel = Some(ch.to_string());
} else if arg == "--target" {
Expand Down

0 comments on commit 8ea5d46

Please sign in to comment.