File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -184,7 +184,7 @@ impl LineIndex {
184184 if let Some ( wide_chars) = self . line_wide_chars . get ( & line_col. line ) {
185185 for c in wide_chars. iter ( ) {
186186 if u32:: from ( c. end ) <= line_col. col {
187- col -= u32:: from ( c. len ( ) ) - c. wide_len ( enc) ;
187+ col = col . checked_sub ( u32:: from ( c. len ( ) ) - c. wide_len ( enc) ) ? ;
188188 } else {
189189 // From here on, all utf16 characters come *after* the character we are mapping,
190190 // so we don't need to take them into account
@@ -201,7 +201,7 @@ impl LineIndex {
201201 if let Some ( wide_chars) = self . line_wide_chars . get ( & line_col. line ) {
202202 for c in wide_chars. iter ( ) {
203203 if col > u32:: from ( c. start ) {
204- col += u32:: from ( c. len ( ) ) - c. wide_len ( enc) as u32 ;
204+ col = col . checked_add ( u32:: from ( c. len ( ) ) - c. wide_len ( enc) ) ? ;
205205 } else {
206206 // From here on, all utf16 characters come *after* the character we are mapping,
207207 // so we don't need to take them into account
You can’t perform that action at this time.
0 commit comments