Skip to content

Commit 028711a

Browse files
committed
Check offset >= 0 before doing text.[offset]
1 parent f985ab1 commit 028711a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

analysis/src/CompletionFrontEnd.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ let completionWithParser1 ~currentFile ~debug ~offset ~path ~posCursor
373373
in
374374
let posOfDot = Pos.posOfDot text ~pos:posCursor ~offset in
375375
let charAtCursor =
376-
if offset < String.length text then text.[offset] else '\n'
376+
if offset >= 0 && offset < String.length text then text.[offset] else '\n'
377377
in
378378
let posBeforeCursor = Pos.posBeforeCursor posCursor in
379379
let charBeforeCursor, blankAfterCursor =

0 commit comments

Comments
 (0)