Skip to content

Commit

Permalink
avoid crashes on systems using lua 5.1
Browse files Browse the repository at this point in the history
  • Loading branch information
tatsumoto-ren committed Oct 18, 2020
1 parent afc9368 commit 63279ba
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions subs2srs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)()
Expand Down Expand Up @@ -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
Expand All @@ -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

Expand Down

0 comments on commit 63279ba

Please sign in to comment.