Skip to content

Commit

Permalink
Merge pull request #857 from alerque/fix-infinite-loop
Browse files Browse the repository at this point in the history
fix(frames): Avoid possible infinite loop when looking for a frame
  • Loading branch information
simoncozens committed Apr 28, 2020
2 parents 5ceee91 + 157dfc8 commit 2c13d78
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion core/frame.lua
Expand Up @@ -246,10 +246,12 @@ SILE.getFrame = function (id)
if type(id) == "table" then
SU.error("Passed a table, expected a string", true)
end
local frame
local frame, last_attempt
while not frame do
frame = SILE.frames[id]
id = id:gsub("_$", "")
if id == last_attempt then break end
last_attempt = id
end
return frame or SU.warn("Couldn't find frame ID "..id, true)
end
Expand Down

0 comments on commit 2c13d78

Please sign in to comment.