Commit 914983b3 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

VLSub: Fix hash generation error handling

parent 7f2cc34c
......@@ -1297,21 +1297,24 @@ openSub = {
local data_end = ""
local size
local chunk_size = 65536
local ok
local err
-- Get data for hash calculation
vlc.msg.dbg("[VLSub] Read hash data from stream")
local file = vlc.stream(openSub.file.uri)
size = file:getsize()
data_start = file:read(chunk_size)
ok, size = pcall(file.getsize, file)
if not size then
vlc.msg.warn("[VLSub] Failed to get stream size")
vlc.msg.warn("[VLSub] Failed to get stream size: " .. size )
setError(lang["mess_err_hash"])
return false
end
if not file:seek( size - chunk_size ) then
vlc.msg.warn("[VLSub] Failed to seek to the end of the stream")
ok, err = pcall(file.seek, file, size - chunk_size)
if not ok then
vlc.msg.warn("[VLSub] Failed to seek to the end of the stream: " .. err)
setError(lang["mess_err_hash"])
return false
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment