From 1bc6bca478872347faa32371663b3aff7b00624f Mon Sep 17 00:00:00 2001 From: Ariel Davis Date: Sat, 6 May 2023 15:05:03 -0700 Subject: [PATCH] Use checked --- lib/line-index/src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/line-index/src/lib.rs b/lib/line-index/src/lib.rs index 6318cbde50bc..622738ce8fb4 100644 --- a/lib/line-index/src/lib.rs +++ b/lib/line-index/src/lib.rs @@ -184,7 +184,7 @@ pub fn to_wide(&self, enc: WideEncoding, line_col: LineCol) -> Option Option u32::from(c.start) { - col += u32::from(c.len()) - c.wide_len(enc) as u32; + col = col.checked_add(u32::from(c.len()) - c.wide_len(enc))?; } else { // From here on, all utf16 characters come *after* the character we are mapping, // so we don't need to take them into account