mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-29 14:14:45 +03:00
LibLine: Avoid crashing if given empty suggestions
This commit is contained in:
parent
223a863c6d
commit
6b513ca97e
Notes:
sideshowbarker
2024-07-19 07:34:56 +09:00
Author: https://github.com/alimpfard Commit: https://github.com/SerenityOS/serenity/commit/6b513ca97e5 Pull-request: https://github.com/SerenityOS/serenity/pull/1810
@ -153,7 +153,10 @@ String Editor::get_line(const String& prompt)
|
||||
|
||||
auto reverse_tab = false;
|
||||
auto increment_suggestion_index = [&] {
|
||||
m_next_suggestion_index = (m_next_suggestion_index + 1) % m_suggestions.size();
|
||||
if (m_suggestions.size())
|
||||
m_next_suggestion_index = (m_next_suggestion_index + 1) % m_suggestions.size();
|
||||
else
|
||||
m_next_suggestion_index = 0;
|
||||
};
|
||||
auto decrement_suggestion_index = [&] {
|
||||
if (m_next_suggestion_index == 0)
|
||||
|
Loading…
Reference in New Issue
Block a user