From 63279ba2f3bdfd3ebeb8e0df32e1ac1afe5265f7 Mon Sep 17 00:00:00 2001 From: Ren Tatsumoto Date: Sun, 18 Oct 2020 10:18:24 +0300 Subject: [PATCH] avoid crashes on systems using lua 5.1 --- subs2srs.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/subs2srs.lua b/subs2srs.lua index bfdf58c..e58a2f4 100644 --- a/subs2srs.lua +++ b/subs2srs.lua @@ -173,7 +173,9 @@ local copy_to_clipboard = (function() if is_empty(text) then return end - assert(io.open(clip_filepath, "w")):write(text):close() + local handle = assert(io.open(clip_filepath, "w")) + handle:write(text) + handle:close() mp.commandv("run", "xclip", "-selection", "clipboard", clip_filepath) end end)() @@ -329,7 +331,7 @@ end local function join_media_fields(note1, note2) if note2 == nil then - goto ret + return note1 end if note2[config.audio_field] then @@ -340,7 +342,6 @@ local function join_media_fields(note1, note2) note1[config.image_field] = note2[config.image_field] .. note1[config.image_field] end - :: ret :: return note1 end