marzzzello / mpv_thumbnail_script

A Lua script to show preview thumbnails in mpv's OSC seekbar, sans external dependencies (fork)
GNU General Public License v3.0
270 stars 20 forks source link

857: bad argument #1 to 'max' (number expected, got nil) #24

Closed Tatsh closed 2 years ago

Tatsh commented 2 years ago

Description of the bug

Sometimes I get this error:

[mpv_thumbnail_script_client_osc]
[mpv_thumbnail_script_client_osc] stack traceback:
[mpv_thumbnail_script_client_osc]       [string "/etc/mpv/scripts/mpv_thumbnail_script_client_..."]:857: in function 'on_thumb_progress'
[mpv_thumbnail_script_client_osc]       [string "/etc/mpv/scripts/mpv_thumbnail_script_client_..."]:1061: in function 'handler'
[mpv_thumbnail_script_client_osc]       mp.defaults:380: in function 'handler'
[mpv_thumbnail_script_client_osc]       mp.defaults:510: in function 'call_event_handlers'
[mpv_thumbnail_script_client_osc]       mp.defaults:555: in function 'dispatch_events'
[mpv_thumbnail_script_client_osc]       mp.defaults:503: in function <mp.defaults:502>
[mpv_thumbnail_script_client_osc]       [C]: at 0x5577b85ca4b0
[mpv_thumbnail_script_client_osc]       [C]: at 0x5577b85cb000
[mpv_thumbnail_script_client_osc] Lua error: [string "/etc/mpv/scripts/mpv_thumbnail_script_client_..."]:857: bad argument #1 to 'max' (number expected, got nil)

That line is here.

It may only be caused when going through a playlist of videos. Could you fallback to 0 if self.state.thumbnails[index] gives nil?

To Reproduce Steps to reproduce the behavior:

  1. Run playlist and skip videos with enter
  2. See error

Expected behavior

Should not error.

Debug log None yet.

Log

Environment

Tatsh commented 2 years ago

I am no longer using this so I'm closing.