Skip to content

Commit

Permalink
Merge pull request #1177 from jiangliu/is-present
Browse files Browse the repository at this point in the history
nydus: fix a possible panic caused by SubCmdArgs::is_present()
  • Loading branch information
imeoer authored Mar 29, 2023
2 parents 35416b0 + fc814a2 commit d719573
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ impl<'a> ServiceArgs for SubCmdArgs<'a> {
}

fn is_present(&self, key: &str) -> bool {
self.subargs.get_flag(key) || self.args.get_flag(key)
matches!(self.subargs.try_get_one::<bool>(key), Ok(Some(true)))
|| matches!(self.args.try_get_one::<bool>(key), Ok(Some(true)))
}
}

Expand Down

0 comments on commit d719573

Please sign in to comment.