mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-29 02:51:57 +00:00
Fix crash when dynamically adding completion item
This commit is contained in:
parent
259d30ef8a
commit
0b1cc52c58
@ -139,8 +139,9 @@ void IncludeComplete::InsertCompletionItem(const std::string& absolute_path,
|
|||||||
// insert if not found or with shorter include path
|
// insert if not found or with shorter include path
|
||||||
auto it = absolute_path_to_completion_item.find(absolute_path);
|
auto it = absolute_path_to_completion_item.find(absolute_path);
|
||||||
if (it == absolute_path_to_completion_item.end() ||
|
if (it == absolute_path_to_completion_item.end() ||
|
||||||
completion_items[it->second].detail.length() > item.detail.length())
|
completion_items[it->second].detail.length() > item.detail.length()) {
|
||||||
absolute_path_to_completion_item[absolute_path] = completion_items.size();
|
absolute_path_to_completion_item[absolute_path] = completion_items.size() - 1;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
lsCompletionItem& inserted_item =
|
lsCompletionItem& inserted_item =
|
||||||
completion_items[inserted_paths[item.detail]];
|
completion_items[inserted_paths[item.detail]];
|
||||||
|
Loading…
Reference in New Issue
Block a user