From a86e82162865bb32fac952110488adc325a1b39b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolo=CC=80=20Tosi?= Date: Tue, 17 Dec 2024 18:31:16 +0100 Subject: [PATCH] Fixed crash on uninitialized allEvents property when deep-linking --- .../ui/eventDetails/EventDetailsFragment.kt | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/it/bz/noi/community/ui/eventDetails/EventDetailsFragment.kt b/app/src/main/java/it/bz/noi/community/ui/eventDetails/EventDetailsFragment.kt index 1ba6d07..4e971ae 100644 --- a/app/src/main/java/it/bz/noi/community/ui/eventDetails/EventDetailsFragment.kt +++ b/app/src/main/java/it/bz/noi/community/ui/eventDetails/EventDetailsFragment.kt @@ -75,7 +75,7 @@ class EventDetailsFragment : Fragment(), EventClickListener { this@EventDetailsFragment) }) - private lateinit var allEvents: ArrayList + private var allEvents: List = emptyList() private val suggestedEvents = arrayListOf() @@ -140,17 +140,13 @@ class EventDetailsFragment : Fragment(), EventClickListener { Status.SUCCESS -> { val events = it.data if (!events.isNullOrEmpty()) { - allEvents = events as ArrayList + allEvents = events } else { binding.tvInterestingForYou.isVisible = false } } - - Status.ERROR -> { - } - - Status.LOADING -> { - } + Status.ERROR -> Unit + Status.LOADING -> Unit } }