Skip to content

Commit

Permalink
parser: fix out of range error
Browse files Browse the repository at this point in the history
  • Loading branch information
papparapa committed Mar 9, 2023
1 parent 9f8cd4a commit dfde6d0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/uucore/src/lib/parser/parse_glob.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ fn fix_negation(glob: &str) -> String {
let mut chars = glob.chars().collect::<Vec<_>>();

let mut i = 0;
while i < chars.len() {
if chars[i] == '[' && i + 4 <= glob.len() && chars[i + 1] == '^' {
while i + 4 <= chars.len() {
if chars[i] == '[' && chars[i + 1] == '^' {
match chars[i + 3..].iter().position(|x| *x == ']') {
None => (),
Some(j) => {
Expand Down

0 comments on commit dfde6d0

Please sign in to comment.