Skip to content

Commit 1a018ad

Browse files
committed
LineContents:splitAtIntervals(): check whether callback result is a number before doing maths with it
1 parent ce80d08 commit 1a018ad

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

l0/ASSFoundation/LineContents.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,9 @@ return function(ASS, ASSFInst, yutilsMissingMsg, createASSClass, re, util, unico
454454
end
455455

456456
while idx <= sectEndIdx do
457-
nextIdx = math.ceil(callback(idx,len))
457+
nextIdx = callback(idx, len)
458+
assertEx(type(nextIdx) == "number", "callback must return a number, got a %s", type(nextIdx))
459+
nextIdx = math.ceil(nextIdx)
458460
assertEx(nextIdx>idx, "index returned by callback function must increase with every iteration, got %d<=%d.",
459461
nextIdx, idx)
460462
-- create a new line

0 commit comments

Comments
 (0)