0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 12:02:23 +02:00

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.
This commit is contained in:
Guido Cella 2024-05-11 19:31:34 +02:00 committed by Kacper Michajłow
parent 9d75289ced
commit 1ebe11d06f

View File

@ -363,7 +363,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