mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-29 11:01:57 +00:00
Fix null pointer dereference but .cquery + header only still does not work
This commit is contained in:
parent
804c9c8b1e
commit
22aa939d3d
@ -479,16 +479,19 @@ Project::Entry Project::FindCompilationEntryForFile(
|
|||||||
Project::Entry result;
|
Project::Entry result;
|
||||||
result.is_inferred = true;
|
result.is_inferred = true;
|
||||||
result.filename = filename;
|
result.filename = filename;
|
||||||
if (best_entry)
|
if (!best_entry)
|
||||||
|
result.args.push_back(filename);
|
||||||
|
else {
|
||||||
result.args = best_entry->args;
|
result.args = best_entry->args;
|
||||||
|
|
||||||
// |best_entry| probably has its own path in the arguments. We need to remap
|
// |best_entry| probably has its own path in the arguments. We need to remap
|
||||||
// that path to the new filename.
|
// that path to the new filename.
|
||||||
std::string best_entry_base_name = GetBaseName(best_entry->filename);
|
std::string best_entry_base_name = GetBaseName(best_entry->filename);
|
||||||
for (std::string& arg : result.args) {
|
for (std::string& arg : result.args) {
|
||||||
if (arg == best_entry->filename ||
|
if (arg == best_entry->filename ||
|
||||||
GetBaseName(arg) == best_entry_base_name) {
|
GetBaseName(arg) == best_entry_base_name) {
|
||||||
arg = filename;
|
arg = filename;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user