fix LiveData value assignment nullability mismatch

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
Marcel Hibbe 2022-07-14 16:12:46 +02:00 committed by Andy Scherzinger (Rebase PR Action)
parent f10b76d430
commit 9afe4e44d6
2 changed files with 5 additions and 3 deletions

View file

@ -92,7 +92,9 @@ class PollResultsFragment : Fragment(), PollResultItemClickListener {
viewModel.items.observe(viewLifecycleOwner) {
val adapter = PollResultsAdapter(user, this).apply {
list = it
if (it != null) {
list = it
}
}
binding.pollResultsList.adapter = adapter
}

View file

@ -65,8 +65,8 @@ class PollResultsViewModel @Inject constructor() : ViewModel() {
private var _unfilteredItems: ArrayList<PollResultItem> = ArrayList()
private var _items: MutableLiveData<ArrayList<PollResultItem>> = MutableLiveData<ArrayList<PollResultItem>>()
val items: LiveData<ArrayList<PollResultItem>>
private var _items: MutableLiveData<ArrayList<PollResultItem>?> = MutableLiveData<ArrayList<PollResultItem>?>()
val items: MutableLiveData<ArrayList<PollResultItem>?>
get() = _items
private var disposable: Disposable? = null