From d98fa04d13857bec70ee6ae7fce5cf55c07689dd Mon Sep 17 00:00:00 2001 From: zwim <36999612+zwim@users.noreply.github.com> Date: Mon, 8 Aug 2022 11:34:33 +0200 Subject: [PATCH] [plugin] Fix crash in AutoWarmth (#9411) Fixes the crash mentioned in https://github.com/koreader/koreader/issues/9409#issuecomment-1207484444? --- plugins/autowarmth.koplugin/main.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/autowarmth.koplugin/main.lua b/plugins/autowarmth.koplugin/main.lua index 15b31228a..bd4586f5a 100644 --- a/plugins/autowarmth.koplugin/main.lua +++ b/plugins/autowarmth.koplugin/main.lua @@ -307,7 +307,7 @@ function AutoWarmth:scheduleNextWarmthChange(time_s, search_pos, from_resume) if self.sched_times_s[i] <= time_s then actual_warmth = self.sched_warmths[i] or actual_warmth local j = i - while self.sched_times_s[j] <= time_s + delay_s do + while j <= #self.sched_warmths and self.sched_times_s[j] <= time_s + delay_s do -- Most times only one iteration through this loop next_warmth = self.sched_warmths[j] or next_warmth j = j + 1