Skip to content

Commit

Permalink
fix: check if streams is initialized
Browse files Browse the repository at this point in the history
Fixes a crash when trying to rotate the video before it is
initialized.
  • Loading branch information
FineFindus committed Nov 20, 2024
1 parent 8242b7c commit 566293e
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,11 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions {
private lateinit var streams: Streams
val isShort
get() = run {
val heightGreaterThanWidth = streams.videoStreams.firstOrNull()?.let {
val heightGreaterThanWidth = ::streams.isInitialized && streams.videoStreams.first().let {
(it.height ?: 0) > (it.width ?: 0)
}

PlayingQueue.getCurrent()?.isShort == true || heightGreaterThanWidth == true
PlayingQueue.getCurrent()?.isShort == true || heightGreaterThanWidth
}

// if null, it's been set to automatic
Expand Down

0 comments on commit 566293e

Please sign in to comment.