Skip to content

Commit 3649777

Browse files
committed
Fix out of range
1 parent d2c8211 commit 3649777

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

Core/Sources/SuggestionInjector/SuggestionInjector.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,10 @@ public struct SuggestionInjector {
148148
let lastRemovedLine = content[safe: end.line]
149149
let startLine = max(0, start.line)
150150
let endLine = max(start.line, min(end.line, content.endIndex - 1))
151-
extraInfo.modifications.append(.deleted(startLine...endLine))
152-
content.removeSubrange(startLine...endLine)
151+
if startLine < content.endIndex {
152+
extraInfo.modifications.append(.deleted(startLine...endLine))
153+
content.removeSubrange(startLine...endLine)
154+
}
153155

154156
var toBeInserted = suggestionContent.breakLines(appendLineBreakToLastLine: true)
155157

0 commit comments

Comments
 (0)