From 1528d75b19b51ae31116052e74238b48e97d2532 Mon Sep 17 00:00:00 2001 From: Tomas Sardyha Date: Tue, 14 Jul 2020 09:44:47 +0200 Subject: [PATCH] Sanitize cached ranges before render ref #34 --- uosc.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/uosc.lua b/uosc.lua index 8fbfc03..4754047 100644 --- a/uosc.lua +++ b/uosc.lua @@ -1424,9 +1424,11 @@ function render_timeline(this) ass:append(ass_opacity(options.timeline_cached_ranges.opacity)) ass:pos(0, 0) ass:draw_start() + local range_start = math.max(type(range['start']) == 'number' and range['start'] or 0.000001, 0.000001) + local range_end = math.min(type(range['end']) and range['end'] or state.duration, state.duration) ass:rect_cw( - bbx * (range['start'] / state.duration), range_ay, - bbx * (range['end'] / state.duration), range_ay + range_height + bbx * (range_start / state.duration), range_ay, + bbx * (range_end / state.duration), range_ay + range_height ) ass:draw_stop() end