Skip to content

Commit 75d6e73

Browse files
committed
fix: check if streams is initialized
Fixes a crash when trying to rotate the player before it is initialized.
1 parent 8242b7c commit 75d6e73

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

app/src/main/java/com/github/libretube/ui/fragments/PlayerFragment.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,11 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions {
141141
private lateinit var streams: Streams
142142
val isShort
143143
get() = run {
144-
val heightGreaterThanWidth = streams.videoStreams.firstOrNull()?.let {
144+
val heightGreaterThanWidth = ::streams.isInitialized && streams.videoStreams.firstOrNull()?.let {
145145
(it.height ?: 0) > (it.width ?: 0)
146-
}
146+
} == true
147147

148-
PlayingQueue.getCurrent()?.isShort == true || heightGreaterThanWidth == true
148+
PlayingQueue.getCurrent()?.isShort == true || heightGreaterThanWidth
149149
}
150150

151151
// if null, it's been set to automatic

0 commit comments

Comments
 (0)