Skip to content

Commit

Permalink
Duration may be nil when decoder has been uninited
Browse files Browse the repository at this point in the history
This fixes this 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
...
```
  • Loading branch information
ento authored and TheAMM committed Nov 3, 2019
1 parent d31228f commit e0225de
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/thumbnailer_shared.lua
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ function Thumbnailer:register_client()
local duration = mp.get_property_native("duration")
local max_duration = thumbnailer_options.autogenerate_max_duration

if self.state.available and thumbnailer_options.autogenerate then
if duration ~= nil and self.state.available and thumbnailer_options.autogenerate then
-- Notify if autogenerate is on and video is not too long
if duration < max_duration or max_duration == 0 then
self:start_worker_jobs()
Expand Down

0 comments on commit e0225de

Please sign in to comment.