C-5 fix: pin uploaderUrl to local val for Kotlin smart-cast

info.uploaderUrl is a nullable String on a uniffi-generated Record;
Kotlin's smart-cast can't prove the second access isn't null after
isNullOrBlank() on a mutable property. Pin to a local val so the
non-null cast carries through the uniffi.strawcore.channelInfo() call.
This commit is contained in:
Kayos 2026-05-24 13:23:54 -07:00
parent 90930ade11
commit b95565bec7

View file

@ -106,10 +106,11 @@ class VideoDetailViewModel : ViewModel() {
// More from this channel via strawcore.channelInfo — one
// Rust round-trip returns the channel's Videos tab pre-mapped.
val uploaderUrl = info.uploaderUrl
val moreFromChannel: List<com.sulkta.straw.feature.search.StreamItem> =
if (info.uploaderUrl.isNullOrBlank()) emptyList()
if (uploaderUrl.isNullOrBlank()) emptyList()
else runCatching {
val ch = uniffi.strawcore.channelInfo(info.uploaderUrl)
val ch = uniffi.strawcore.channelInfo(uploaderUrl)
ch.videos
.filter { it.url != streamUrl }
.take(20)
@ -118,7 +119,7 @@ class VideoDetailViewModel : ViewModel() {
url = v.url,
title = v.title.ifBlank { "(no title)" },
uploader = v.uploader.ifBlank { uploader },
uploaderUrl = v.uploaderUrl ?: info.uploaderUrl,
uploaderUrl = v.uploaderUrl ?: uploaderUrl,
thumbnail = v.thumbnail,
durationSeconds = v.durationSeconds,
viewCount = v.viewCount,