fix #29 check for overflow

This commit is contained in:
Guy Korland
2019-12-17 17:47:46 +02:00
committed by Changseok Han
parent 9fa0f74ce9
commit 636618e4ac

View File

@ -1058,7 +1058,7 @@ fn replace_value<F: FnMut(Value) -> Option<Value>>(
) {
let mut target = value;
let last_index = tokens.len() - 1;
let last_index = tokens.len().checked_sub(1).unwrap_or(0);
for (i, token) in tokens.drain(..).enumerate() {
let target_once = target;
let is_last = i == last_index;