Accept null value for Nextcloud News feed attribute folderId. Fixes #87
This commit is contained in:
parent
d4e546b6c1
commit
cec3c467cf
@ -1,6 +1,7 @@
|
||||
package com.readrops.api.services.nextcloudnews.adapters
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import com.readrops.api.utils.nextNullableInt
|
||||
import com.readrops.db.entities.Feed
|
||||
import com.readrops.api.utils.nextNullableString
|
||||
import com.squareup.moshi.FromJson
|
||||
@ -43,8 +44,8 @@ class NextNewsFeedsAdapter {
|
||||
2 -> name = reader.nextString()
|
||||
3 -> iconUrl = reader.nextString()
|
||||
4 -> {
|
||||
val nextInt = reader.nextInt()
|
||||
remoteFolderId = if (nextInt > 0) nextInt.toString() else null
|
||||
val nextInt = reader.nextNullableInt()
|
||||
remoteFolderId = if (nextInt != null && nextInt > 0) nextInt.toString() else null
|
||||
}
|
||||
5 -> siteUrl = reader.nextNullableString()
|
||||
else -> reader.skipValue()
|
||||
|
@ -3,4 +3,7 @@ package com.readrops.api.utils
|
||||
import com.squareup.moshi.JsonReader
|
||||
|
||||
fun JsonReader.nextNullableString(): String? =
|
||||
if (peek() != JsonReader.Token.NULL) nextString() else nextNull()
|
||||
if (peek() != JsonReader.Token.NULL) nextString() else nextNull()
|
||||
|
||||
fun JsonReader.nextNullableInt(): Int? =
|
||||
if (peek() != JsonReader.Token.NULL) nextInt() else nextNull()
|
Loading…
x
Reference in New Issue
Block a user