Fix crash when finishing insert completion with no completion candidates

This commit is contained in:
Maxime Coste 2019-04-26 11:49:55 +01:00
parent 0cc89b2b9f
commit f6e58e7271

View File

@ -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())