fix: Unread and starred can be null.
All checks were successful
continuous-integration/drone/tag Build is passing

This commit is contained in:
aminecmi 2023-03-09 20:46:09 +01:00
parent 1f3fa0c4a6
commit 0635a8a207
2 changed files with 4 additions and 4 deletions

View File

@ -24,8 +24,8 @@ class SelfossModel {
@Serializable @Serializable
class Stats( class Stats(
val total: Int, val total: Int,
val unread: Int, val unread: Int?,
val starred: Int val starred: Int?
) )
@Serializable @Serializable

View File

@ -132,9 +132,9 @@ class Repository(
if (isNetworkAvailable()) { if (isNetworkAvailable()) {
val response = api.stats() val response = api.stats()
if (response.success && response.data != null) { if (response.success && response.data != null) {
_badgeUnread.value = response.data.unread _badgeUnread.value = response.data.unread ?: 0
_badgeAll.value = response.data.total _badgeAll.value = response.data.total
_badgeStarred.value = response.data.starred _badgeStarred.value = response.data.starred ?: 0
success = true success = true
} }
} else if (appSettingsService.isItemCachingEnabled()) { } else if (appSettingsService.isItemCachingEnabled()) {