From 24ada98df66eedf9a79f2d62998e85133b9303da Mon Sep 17 00:00:00 2001 From: Slavik Urdzik Date: Fri, 7 Feb 2020 18:45:03 +0200 Subject: [PATCH] Fixed bug with isEmpty --- .../java/com/example/movieapp/overview/OverviewViewModel.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/example/movieapp/overview/OverviewViewModel.kt b/app/src/main/java/com/example/movieapp/overview/OverviewViewModel.kt index ba423cd..e77b020 100644 --- a/app/src/main/java/com/example/movieapp/overview/OverviewViewModel.kt +++ b/app/src/main/java/com/example/movieapp/overview/OverviewViewModel.kt @@ -10,7 +10,6 @@ import com.example.movieapp.domain.Movie import com.example.movieapp.repository.MoviesRepository import kotlinx.coroutines.launch - class OverviewViewModel(application: Application) : ViewModel() { //LiveData object of movie @@ -42,6 +41,9 @@ class OverviewViewModel(application: Application) : ViewModel() { _eventNetworkError.value = false _isNetworkErrorShown.value = false } catch (e: Exception) { + if (playList.value.isNullOrEmpty()) { + _eventNetworkError.value = true + } } } }