From 836ffddd4fb81f0b5a115f483c13aa47dc43e008 Mon Sep 17 00:00:00 2001 From: ronaldheft Date: Fri, 2 Sep 2022 18:36:57 -0400 Subject: [PATCH] Fix race condition with chapter sleep timer --- ios/App/Shared/player/AudioPlayerSleepTimer.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ios/App/Shared/player/AudioPlayerSleepTimer.swift b/ios/App/Shared/player/AudioPlayerSleepTimer.swift index 18ad7aee..646ac5a6 100644 --- a/ios/App/Shared/player/AudioPlayerSleepTimer.swift +++ b/ios/App/Shared/player/AudioPlayerSleepTimer.swift @@ -27,8 +27,8 @@ extension AudioPlayer { sleepTimeRemaining = self.sleepTimeRemaining } - // Guard against invalid sleep timers - if sleepTimeRemaining?.isLess(than: 0) ?? false { + // Guard against invalid sleep timers, but give it a chance to go 1 second negative to prevent a raise condition + if sleepTimeRemaining?.isLess(than: -1) ?? false { self.removeSleepTimer() return nil }