Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: check if streams is initialized #6802

Merged
merged 1 commit into from
Nov 20, 2024

Conversation

FineFindus
Copy link
Contributor

Fixes a crash when trying to rotate the player before it is initialized, most likely introduced in 76d7c62.

@@ -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 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

videoStreams can in fact be empty for some live streams, hence changing it to first() would cause yet another crash.

Fixes a crash when trying to rotate the player before it is
initialized.
@Bnyro Bnyro merged commit a516238 into libre-tube:master Nov 20, 2024
3 checks passed
@FineFindus FineFindus deleted the fix/rotate-crash branch November 20, 2024 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants