Fix null pointer dereference but .cquery + header only still does not work

This commit is contained in:
Fangrui Song 2018-01-15 17:30:26 -08:00
parent 804c9c8b1e
commit 22aa939d3d

View File

@ -479,7 +479,9 @@ 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
@ -491,6 +493,7 @@ Project::Entry Project::FindCompilationEntryForFile(
arg = filename; arg = filename;
} }
} }
}
return result; return result;
} }