History

console.lua: don't crash when scrolling without matches

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.

Guido Cella committed 2 years ago

Commit 1ebe11d1 parent 9d752891 file · +1 −1Browse files

Unified · Split

player/lua/console.lua+1−1
@@ -363,7 +363,7 @@ local function fuzzy_find(needle, haystacks) · 362 unmodified lines
363end363end
364 364
365local function populate_log_with_matches(max_width)365local function populate_log_with_matches(max_width)
366 if not selectable_items then366 if not selectable_items or selected_match == 0 then
367 return367 return
368 end368 end
369 369

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t