From b95565bec7453c138aae87b2fbf991da2363b9f6 Mon Sep 17 00:00:00 2001 From: Kayos Date: Sun, 24 May 2026 13:23:54 -0700 Subject: [PATCH] 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. --- .../sulkta/straw/feature/detail/VideoDetailViewModel.kt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/strawApp/src/main/kotlin/com/sulkta/straw/feature/detail/VideoDetailViewModel.kt b/strawApp/src/main/kotlin/com/sulkta/straw/feature/detail/VideoDetailViewModel.kt index 96579977d..63dea79c3 100644 --- a/strawApp/src/main/kotlin/com/sulkta/straw/feature/detail/VideoDetailViewModel.kt +++ b/strawApp/src/main/kotlin/com/sulkta/straw/feature/detail/VideoDetailViewModel.kt @@ -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 = - 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,