Fix overflow of string reverse iteration

This issue does not appear in CI.
This commit is contained in:
ChJR committed 2020-11-20 02:46:53 +09:00
1 parent 0eba3ba80b
commit 3e3bd07ff8
1 file changed
+5 -1
+5 -1
View File
@@ -180,7 +180,11 @@ impl PyIter for PyStrReverseIterator {
break;
}
}
start.unwrap_or(end - 4)
if end < 4 {
start.unwrap_or(0)
} else {
start.unwrap_or(end - 4)
}
};
let stored = zelf.position.swap(start);