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 {
184
184
if let Some ( wide_chars) = self . line_wide_chars . get ( & line_col. line ) {
185
185
for c in wide_chars. iter ( ) {
186
186
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) ) ? ;
188
188
} else {
189
189
// From here on, all utf16 characters come *after* the character we are mapping,
190
190
// so we don't need to take them into account
@@ -201,7 +201,7 @@ impl LineIndex {
201
201
if let Some ( wide_chars) = self . line_wide_chars . get ( & line_col. line ) {
202
202
for c in wide_chars. iter ( ) {
203
203
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) ) ? ;
205
205
} else {
206
206
// From here on, all utf16 characters come *after* the character we are mapping,
207
207
// so we don't need to take them into account
You can’t perform that action at this time.
0 commit comments