fix: check if streams is initialized

Fixes a crash when trying to rotate the player before it is
initialized.
This commit is contained in:
FineFindus 2024-11-20 16:41:18 +01:00
parent 8242b7c045
commit 75d6e734e5
No known key found for this signature in database
GPG Key ID: 64873EE210FF8E6B

View File

@ -141,11 +141,11 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions {
private lateinit var streams: Streams private lateinit var streams: Streams
val isShort val isShort
get() = run { get() = run {
val heightGreaterThanWidth = streams.videoStreams.firstOrNull()?.let { val heightGreaterThanWidth = ::streams.isInitialized && streams.videoStreams.firstOrNull()?.let {
(it.height ?: 0) > (it.width ?: 0) (it.height ?: 0) > (it.width ?: 0)
} } == true
PlayingQueue.getCurrent()?.isShort == true || heightGreaterThanWidth == true PlayingQueue.getCurrent()?.isShort == true || heightGreaterThanWidth
} }
// if null, it's been set to automatic // if null, it's been set to automatic