Skip to content

Commit 66f87ac

Browse files
author
blank_name
committed
Have workers guard against a nil duration before starting work. This seems to happen when a worker is assigned a job and between this assignment and the worker starting to do the job the video ends.
1 parent 75c9f65 commit 66f87ac

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/thumbnailer_server.lua

+7-1
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,12 @@ function do_worker_job(state_json_string, frames_json_string)
146146
end
147147

148148
local file_duration = mp.get_property_native("duration")
149+
-- We seem to end up with a nil duration when a worker is assigned a job and
150+
-- then the video ends before we reach this point.
151+
if file_duration == nil then
152+
return
153+
end
154+
149155
local file_path = thumb_state.worker_input_path
150156

151157
if thumb_state.is_remote then
@@ -270,4 +276,4 @@ register_timer = mp.add_periodic_timer(0.1, register_function)
270276
mp.register_script_message("mpv_thumbnail_script-slaved", function()
271277
msg.debug("Successfully registered with master")
272278
register_timer:stop()
273-
end)
279+
end)

0 commit comments

Comments
 (0)