1
1
дзеркало https://git.shadowkat.net/izaya/OC-PsychOS2.git synced 2024-09-27 06:35:20 -04:00

fix edge case where io.open(whatever):read() returns nil

This commit is contained in:
XeonSquared 2023-08-04 20:24:18 +10:00
джерело c2bbd7d2ca
коміт a33476cf00

@ -24,7 +24,7 @@ end
function mtar.iter(stream) -- table -- function -- Given buffer *stream*, returns an iterator suitable for use with *for* that returns, for each iteration, the file name, a function to read from the file, and the length of the file.
local remain = 0
local function read(n)
local rb = stream:read(math.min(n,remain))
local rb = stream:read(math.min(n,remain)) or ""
remain = remain - rb:len()
return rb
end