Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix out-of-bounds error on
new_replace_table
The `for i in 0..new_replace_table.len() - 1` loop gave me an "index out of bounds: the len is 0 but the index is 0" run-time error. The problem is that the subtraction underflows when the length of the vector is zero, since the LHS is of type `usize`. (The underflow would lead to an "attempt to subtract with overflow" run-time error with debug builds but not with release builds.) This commit fixes the problem by using `.windows(2)` to get an iterator over overlapping subslices of length two.
- Loading branch information