diff options
Diffstat (limited to 'vendor/regex/src/re_trait.rs')
-rw-r--r-- | vendor/regex/src/re_trait.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/vendor/regex/src/re_trait.rs b/vendor/regex/src/re_trait.rs index d0c717df5..505810c84 100644 --- a/vendor/regex/src/re_trait.rs +++ b/vendor/regex/src/re_trait.rs @@ -20,7 +20,7 @@ impl Locations { /// not match anything. The positions returned are *always* byte indices /// with respect to the original string matched. pub fn pos(&self, i: usize) -> Option<(usize, usize)> { - let (s, e) = (i * 2, i * 2 + 1); + let (s, e) = (i.checked_mul(2)?, i.checked_mul(2)?.checked_add(1)?); match (self.0.get(s), self.0.get(e)) { (Some(&Some(s)), Some(&Some(e))) => Some((s, e)), _ => None, |