Skip to content

Commit

Permalink
console.lua: don't crash when scrolling without matches
Browse files Browse the repository at this point in the history
selected_match can become 0 when pressing certain scrolling
keybindings without any match, and

for i = first_match_to_print, last_match_to_print do

in populate_log_with_matches() runs from 0 to 0 and accessing
matches[0].text crashes console.lua. Return early when it is 0.
  • Loading branch information
guidocella committed May 12, 2024
1 parent af6c941 commit 94be59e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion player/lua/console.lua
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ local function fuzzy_find(needle, haystacks)
end

local function populate_log_with_matches(max_width)
if not selectable_items then
if not selectable_items or selected_match == 0 then
return
end

Expand Down

0 comments on commit 94be59e

Please sign in to comment.