Merge pull request #23 from google-developer-training/developer

Fix: KotlinNullPointerException in LiveData when attempting to get a …
This commit is contained in:
jtavva 2020-01-27 15:02:28 -08:00 committed by GitHub
commit 4a9a01d550
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -114,7 +114,7 @@ class DevByteViewModel(application: Application) : AndroidViewModel(application)
} catch (networkError: IOException) { } catch (networkError: IOException) {
// Show a Toast error message and hide the progress bar. // Show a Toast error message and hide the progress bar.
if(playlist.value!!.isEmpty()) if(playlist.value.isNullOrEmpty())
_eventNetworkError.value = true _eventNetworkError.value = true
} }
} }

View File

@ -114,7 +114,7 @@ class DevByteViewModel(application: Application) : AndroidViewModel(application)
} catch (networkError: IOException) { } catch (networkError: IOException) {
// Show a Toast error message and hide the progress bar. // Show a Toast error message and hide the progress bar.
if(playlist.value!!.isEmpty()) if(playlist.value.isNullOrEmpty())
_eventNetworkError.value = true _eventNetworkError.value = true
} }
} }