diff options
| author | Maxime Coste <mawww@kakoune.org> | 2019-04-26 11:49:55 +0100 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2019-04-26 11:49:55 +0100 |
| commit | f6e58e7271bdebb2c289405f8fba91090d5345da (patch) | |
| tree | 9c065b0ba26a69fc45be116d7a79307d8af3b3e3 /src/insert_completer.cc | |
| parent | 0cc89b2b9f3cdeff960bd55a865ee0f52fa98d25 (diff) | |
Fix crash when finishing insert completion with no completion candidates
Diffstat (limited to 'src/insert_completer.cc')
| -rw-r--r-- | src/insert_completer.cc | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/insert_completer.cc b/src/insert_completer.cc index 5c1e9468..b49fa9bc 100644 --- a/src/insert_completer.cc +++ b/src/insert_completer.cc @@ -465,7 +465,10 @@ void InsertCompleter::reset() { if (m_explicit_completer or m_completions.is_valid()) { - String selected_item = std::move(m_completions.candidates[m_current_candidate].completion); + String selected_item; + if (m_current_candidate >= 0 and m_current_candidate < m_completions.candidates.size()) + selected_item = std::move(m_completions.candidates[m_current_candidate].completion); + m_explicit_completer = nullptr; m_completions = InsertCompletion{}; if (m_context.has_client()) |
