fix: fix an issue caused by #44

This commit is contained in:
registerGen 2022-06-29 18:17:40 +08:00
parent 222ac1ce7e
commit f3677a7530

View File

@ -113,7 +113,7 @@ local function lines_from(file, count)
if first_k:find('\0') then
return {'binary file'}
end
local lines = {'```' .. vim.filetype.match { filename = file }}
local lines = { '```' .. (vim.filetype.match { filename = file } or '') }
for line in first_k:gmatch("[^\r\n]+") do
lines[#lines + 1] = line
if count ~= nil and #lines >= count then