Skip to content

Commit

Permalink
Fixed crash in AnnotationParser (#1297)
Browse files Browse the repository at this point in the history
  • Loading branch information
art-divin committed Mar 11, 2024
1 parent 122cbb6 commit dab9b28
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,9 @@ public struct AnnotationsParser {
let utf8View = sourceLine.content.utf8
var startIndex: String.UTF8View.Index
var endIndex: String.UTF8View.Index
guard utf8View.count > position.character else {
return ("", sourceLine)
}
if shouldUsePositionBeforeTrailing {
startIndex = utf8View.index(utf8View.startIndex, offsetBy: (position.character - 1))
endIndex = utf8View.endIndex
Expand Down

0 comments on commit dab9b28

Please sign in to comment.