Check that header 'x-chat-last-given' exists

Without that check a null pointer exception occurs if the header is not
set.

Signed-off-by: Tim Krüger <t@timkrueger.me>
This commit is contained in:
Tim Krüger 2022-04-27 12:31:24 +02:00
parent a40e4111e1
commit d14f4b38ea
No known key found for this signature in database
GPG Key ID: FECE3A7222C52A4E

View File

@ -39,7 +39,10 @@ class SharedItemsViewModel(private val repository: SharedItemsRepository) : View
override fun onSubscribe(d: Disposable) = Unit override fun onSubscribe(d: Disposable) = Unit
override fun onNext(response: Response<ChatShareOverall>) { override fun onNext(response: Response<ChatShareOverall>) {
if(response.headers()["x-chat-last-given"] != null) {
chatLastGiven = response.headers()["x-chat-last-given"]!! chatLastGiven = response.headers()["x-chat-last-given"]!!
}
val mediaItems = response.body()!!.ocs!!.data val mediaItems = response.body()!!.ocs!!.data
mediaItems?.forEach { mediaItems?.forEach {