Skip to content
This repository was archived by the owner on Nov 24, 2023. It is now read-only.

Commit 9eaa419

Browse files
committed
Prevent underflow
1 parent 33216bd commit 9eaa419

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ pub fn apply_suggestions(code: &str, suggestions: &[Suggestion]) -> Result<Strin
229229
for r in &sol.replacements {
230230
fixed.replace_range(
231231
r.snippet.range.start,
232-
r.snippet.range.end - 1,
232+
r.snippet.range.end.saturating_sub(1),
233233
r.replacement.as_bytes(),
234234
)?;
235235
}

0 commit comments

Comments
 (0)