From 6dcd9afc31f2ddc4fc836bd435bc3c4eefe30ba7 Mon Sep 17 00:00:00 2001 From: Antoine POPINEAU Date: Thu, 11 Jun 2020 08:08:20 +0200 Subject: [PATCH] Fixed an issue where RadiosFragment would wake up on track change even when the app is killed, causing a crash. --- .../com/github/apognu/otter/fragments/RadiosFragment.kt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/github/apognu/otter/fragments/RadiosFragment.kt b/app/src/main/java/com/github/apognu/otter/fragments/RadiosFragment.kt index e495e9a..74bcf88 100644 --- a/app/src/main/java/com/github/apognu/otter/fragments/RadiosFragment.kt +++ b/app/src/main/java/com/github/apognu/otter/fragments/RadiosFragment.kt @@ -37,9 +37,11 @@ class RadiosFragment : FunkwhaleFragment() { GlobalScope.launch(Main) { EventBus.get().collect { message -> when (message) { - is Event.RadioStarted -> recycler.forEach { - it.isEnabled = true - it.isClickable = true + is Event.RadioStarted -> + if (radios != null) { recycler.forEach { + it.isEnabled = true + it.isClickable = true + } } } }