Skip to content

Commit 42d3a5e

Browse files
authored
Merge pull request #65404 from ahoppen/ahoppen/cursor-info-at-eof
[CursorInfo] Don’t crash if we are performing cursor info at EOF
2 parents f80c472 + 6fcfe7f commit 42d3a5e

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

lib/Parse/Lexer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ void Lexer::initialize(unsigned Offset, unsigned EndOffset) {
214214
// inserted to mark the code completion token. If the IDE inspection offset
215215
// points to a normal character, no code completion token should be
216216
// inserted.
217-
if (Ptr >= BufferStart && Ptr <= BufferEnd && *Ptr == '\0') {
217+
if (Ptr >= BufferStart && Ptr < BufferEnd && *Ptr == '\0') {
218218
CodeCompletionPtr = Ptr;
219219
}
220220
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// RUN: %sourcekitd-test -req=cursor -pos=2:1 %s -- %s

0 commit comments

Comments
 (0)