From f6e58e7271bdebb2c289405f8fba91090d5345da Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Fri, 26 Apr 2019 11:49:55 +0100 Subject: [PATCH] Fix crash when finishing insert completion with no completion candidates --- src/insert_completer.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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())