From 52676f15552301eb091a9d7100f51fd6dd8ed9cc Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Tue, 25 May 2021 13:44:42 +1000 Subject: [PATCH] fix a panic when browser encounters a filtered card outside filtered deck the -99999 due date overflows the i32, yielding to a stuck interface when running in a debug build --- rslib/src/browser_table.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/rslib/src/browser_table.rs b/rslib/src/browser_table.rs index 432ac1d92..1e988b79a 100644 --- a/rslib/src/browser_table.rs +++ b/rslib/src/browser_table.rs @@ -104,10 +104,9 @@ impl Card { if self.queue == CardQueue::Learn { Some(TimestampSecs(self.due as i64)) } else if self.is_due_in_days() { - Some( - TimestampSecs::now() - .adding_secs(((self.due - timing.days_elapsed as i32) * 86400) as i64), - ) + Some(TimestampSecs::now().adding_secs( + ((self.due - timing.days_elapsed as i32).saturating_mul(86400)) as i64, + )) } else { None }