Skip to content

Commit

Permalink
fix(outputters): Don't attempt to create output if we error before pr…
Browse files Browse the repository at this point in the history
…ocessing even starts
  • Loading branch information
alerque committed Dec 5, 2024
1 parent bfd24b5 commit d38ff03
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion core/utilities/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ function utilities.error (message, isbug)
utilities.warn(message, isbug)
_skip_traceback_levels = 2
io.stderr:flush()
SILE.outputter:finish() -- Only really useful from the REPL but no harm in trying
SILE.outputter:finish()
SILE.scratch.caughterror = true
error("", 2)
end
Expand Down
13 changes: 7 additions & 6 deletions outputters/libtexpdf.lua
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,13 @@ end
function outputter._endHook (_) end

function outputter:finish ()
self:_ensureInit()
pdf.endpage()
self:runHooks("prefinish")
pdf.finish()
started = false
lastkey = nil
if started then
pdf.endpage()
self:runHooks("prefinish")
pdf.finish()
started = false
lastkey = nil
end
end

function outputter.getCursor (_)
Expand Down

0 comments on commit d38ff03

Please sign in to comment.