From 10add04b9138b13ba36a53a20e990bfe82d343ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20Fabian=20Kr=C3=BCger?= Date: Tue, 25 Aug 2020 00:20:23 +0200 Subject: [PATCH] Handle token.to_string returning nil for empty --- luametalatex-firstcode.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/luametalatex-firstcode.lua b/luametalatex-firstcode.lua index e02e6b5..7039c92 100644 --- a/luametalatex-firstcode.lua +++ b/luametalatex-firstcode.lua @@ -135,7 +135,8 @@ token.luacmd("closein", function(_, prefix) end, "value") local function do_write(p) - local content = token.to_string(p.data) .. '\n' + local data = token.to_string(p.data) + local content = data and data .. '\n' or '\n' local file = ofiles[p.file] if file then file:write(content)