fix crash when trying to view account with invalid id

closes #848
This commit is contained in:
Conny Duck 2018-09-15 21:51:53 +02:00
parent 16aea96e97
commit 5621e5d2d4
1 changed files with 1 additions and 1 deletions

View File

@ -69,7 +69,7 @@ class AccountViewModel @Inject constructor(
override fun onResponse(call: Call<List<Relationship>>, override fun onResponse(call: Call<List<Relationship>>,
response: Response<List<Relationship>>) { response: Response<List<Relationship>>) {
val relationships = response.body() val relationships = response.body()
if (response.isSuccessful && relationships != null) { if (response.isSuccessful && relationships != null && relationships.getOrNull(0) != null) {
val relationship = relationships[0] val relationship = relationships[0]
relationshipData.postValue(Success(relationship)) relationshipData.postValue(Success(relationship))
} else { } else {