TheAMM / mpv_thumbnail_script

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

Fix error "attempt to compare nil with number" #43

Closed ento closed 5 years ago

ento commented 5 years ago

This fixes an error that gets logged every time a video finishes playing:

...
[vd] Uninit decoder.
[client_osc]
[client_osc] stack traceback:
[client_osc]    mp.defaults:366: in function 'handler'
[client_osc]    mp.defaults:460: in function 'call_event_handlers'
[client_osc]    mp.defaults:494: in function 'dispatch_events'
[client_osc]    mp.defaults:453: in function <mp.defaults:452>
[client_osc]    [C]: at 0x5745da2c25d0
[client_osc]    [C]: at 0x5745da2c38d0
[client_osc] Lua error:
...jmrbar-mpv_thumbnail_script-0.4.2/scripts/client_osc.lua:1087:
attempt to compare nil with number
...

Tested on mpv version 0.29.0:

$ mpv --version
mpv 0.29.0-910-gd66eb93e5d Copyright © 2000-2019 mpv/MPlayer/mplayer2 projects
 built on Thu Oct 24 22:37:22 AKDT 2019
ffmpeg library versions:
   libavutil       56.35.101
   libavcodec      58.59.102
   libavformat     58.33.100
   libswscale      5.6.100
   libavfilter     7.65.100
   libswresample   3.6.100
ffmpeg version: N-95553-g155508c6e9
w1kl4s commented 5 years ago

Got broken for me with upgrade to mpv 0.30. This fixed the error.

➜  ~ mpv --version
mpv 0.30.0 Copyright © 2000-2019 mpv/MPlayer/mplayer2 projects
 built on UNKNOWN
ffmpeg library versions:
   libavutil       56.22.100
   libavcodec      58.35.100
   libavformat     58.20.100
   libswscale      5.3.100
   libavfilter     7.40.101
   libswresample   3.3.100
ffmpeg version: 4.1.4
TheAMM commented 5 years ago

There's now been several PRs for fixing this and I've sort of ignored them because I was surely going to rewrite this entire thing, but now I have to admit it's a very unknown ETA, so hey Let's Get This Merged.

ento commented 5 years ago

Oops, sorry for not looking at other PRs and thanks for the merge.

garoto commented 5 years ago

so hey Let's Get This Merged.

I recognize that reverse acronym.