Skip to content

Commit 9bd5cc6

Browse files
committed
fix: return early if sheet is null
1 parent 989602d commit 9bd5cc6

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

app/src/main/java/to/bitkit/utils/timedsheets/TimedSheetManager.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,15 @@ class TimedSheetManager(private val scope: CoroutineScope) {
4343
}
4444

4545
fun dismissCurrentSheet(skipQueue: Boolean = false) {
46+
if (currentTimedSheet == null) return
47+
4648
scope.launch {
4749
currentTimedSheet?.onDismissed()
50+
_currentSheet.value = null
51+
currentTimedSheet = null
4852

4953
if (skipQueue) {
5054
Logger.debug("Clearing timed sheet queue", context = TAG)
51-
_currentSheet.value = null
52-
currentTimedSheet = null
5355
} else {
5456
delay(CHECK_DELAY_MILLIS)
5557
checkAndShowNextSheet()
@@ -58,6 +60,7 @@ class TimedSheetManager(private val scope: CoroutineScope) {
5860
}
5961

6062
private suspend fun checkAndShowNextSheet() {
63+
Logger.debug("Queued sheets: ${registeredSheets.map { it.type.name }}")
6164
for (sheet in registeredSheets.toList()) {
6265
if (sheet.shouldShow()) {
6366
Logger.debug(

0 commit comments

Comments
 (0)