mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-22 23:55:08 +00:00
Fix null pointer dereference of param.primary_file
This commit is contained in:
parent
181b405c54
commit
007bc5362c
@ -1932,6 +1932,8 @@ std::vector<std::unique_ptr<IndexFile>> ParseWithTu(
|
||||
perf->index_build = timer.ElapsedMicrosecondsAndReset();
|
||||
|
||||
std::unordered_map<std::string, int> inc_to_line;
|
||||
// TODO
|
||||
if (param.primary_file)
|
||||
for (auto &inc : param.primary_file->includes)
|
||||
inc_to_line[inc.resolved_path] = inc.line;
|
||||
|
||||
@ -1940,6 +1942,7 @@ std::vector<std::unique_ptr<IndexFile>> ParseWithTu(
|
||||
entry->import_file = file;
|
||||
entry->args = args;
|
||||
|
||||
if (param.primary_file) {
|
||||
// If there are errors, show at least one at the include position.
|
||||
auto it = inc_to_line.find(entry->path);
|
||||
if (it != inc_to_line.end()) {
|
||||
@ -1953,6 +1956,7 @@ std::vector<std::unique_ptr<IndexFile>> ParseWithTu(
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Update file contents and modification time.
|
||||
entry->file_contents_ = param.file_contents[entry->path].contents;
|
||||
|
Loading…
Reference in New Issue
Block a user