Make `cancel` in `SleepTimer` synchronized too

This commit is contained in:
Ensar Sarajčić 2023-10-09 08:18:38 +02:00
parent 82c4acc96f
commit c59108e1ad
1 changed files with 1 additions and 1 deletions

View File

@ -20,7 +20,7 @@ object SleepTimer {
val timeLeft = _timeLeft.asSharedFlow()
private val scope = CoroutineScope(Dispatchers.Default)
fun cancel() {
fun cancel() = synchronized(this@SleepTimer) {
sleepTimer?.cancel()
sleepTimer = null
}