mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-25 17:11:59 +00:00
Harden against bad language server method call in completion.
This commit is contained in:
parent
d816e2618a
commit
385531521f
@ -1972,7 +1972,11 @@ bool QueryDbMainLoop(
|
||||
|
||||
// TODO: We should scan include directories to add any missing paths
|
||||
|
||||
std::string buffer_line = file->all_buffer_lines[msg->params.position.line];
|
||||
// It shouldn't be possible, but sometimes vscode will send queries out
|
||||
// of order, ie, we get completion request before buffer content update.
|
||||
std::string buffer_line;
|
||||
if (msg->params.position.line >= 0 && msg->params.position.line < file->all_buffer_lines.size())
|
||||
buffer_line = file->all_buffer_lines[msg->params.position.line];
|
||||
|
||||
if (ShouldRunIncludeCompletion(buffer_line)) {
|
||||
Out_TextDocumentComplete complete_response;
|
||||
|
Loading…
Reference in New Issue
Block a user