Skip to content

Commit f9994ab

Browse files
committed
Prevent tapping on thumbnail if video details are not loaded
1 parent ca0f56e commit f9994ab

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -505,12 +505,18 @@ public void onClick(final View v) {
505505
}
506506
break;
507507
case R.id.detail_thumbnail_root_layout:
508-
autoPlayEnabled = true; // forcefully start playing
509-
// FIXME Workaround #7427
510-
if (isPlayerAvailable()) {
511-
player.setRecovery();
508+
// make sure not to open any player if there is nothing currently loaded!
509+
// FIXME removing this `if` causes the player service to start correctly, then stop,
510+
// then restart badly without calling `startForeground()`, causing a crash when
511+
// later closing the detail fragment
512+
if (currentInfo != null) {
513+
autoPlayEnabled = true; // forcefully start playing
514+
// FIXME Workaround #7427
515+
if (isPlayerAvailable()) {
516+
player.setRecovery();
517+
}
518+
openVideoPlayerAutoFullscreen();
512519
}
513-
openVideoPlayerAutoFullscreen();
514520
break;
515521
case R.id.detail_title_root_layout:
516522
toggleTitleAndSecondaryControls();

0 commit comments

Comments
 (0)