From 2b446d5b0fb1ed023097aa7b06becc9d79343f58 Mon Sep 17 00:00:00 2001 From: Bnyro Date: Sat, 15 Apr 2023 19:24:48 +0200 Subject: [PATCH] Fix crash when a channel doesn't have a description --- app/src/main/java/com/github/libretube/api/obj/Channel.kt | 2 +- .../java/com/github/libretube/ui/fragments/ChannelFragment.kt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/github/libretube/api/obj/Channel.kt b/app/src/main/java/com/github/libretube/api/obj/Channel.kt index 95bdc932e..67573ea8f 100644 --- a/app/src/main/java/com/github/libretube/api/obj/Channel.kt +++ b/app/src/main/java/com/github/libretube/api/obj/Channel.kt @@ -8,7 +8,7 @@ data class Channel( val name: String? = null, val avatarUrl: String? = null, val bannerUrl: String? = null, - val description: String = "", + val description: String? = null, val nextpage: String? = null, val subscriberCount: Long = 0, val verified: Boolean = false, diff --git a/app/src/main/java/com/github/libretube/ui/fragments/ChannelFragment.kt b/app/src/main/java/com/github/libretube/ui/fragments/ChannelFragment.kt index 067491541..1e326fa38 100644 --- a/app/src/main/java/com/github/libretube/ui/fragments/ChannelFragment.kt +++ b/app/src/main/java/com/github/libretube/ui/fragments/ChannelFragment.kt @@ -172,10 +172,10 @@ class ChannelFragment : Fragment() { R.string.subscribers, response.subscriberCount.formatShort() ) - if (response.description.isBlank()) { + if (response.description.orEmpty().isBlank()) { binding.channelDescription.visibility = View.GONE } else { - binding.channelDescription.text = response.description.trim() + binding.channelDescription.text = response.description.orEmpty().trim() } binding.channelDescription.setOnClickListener {