Skip to content

Commit ab6e25d

Browse files
committed
Player/handleIntent: fix enqueue if player not running
In 063dcd4 I falsely claimed that the fallthrough case is always degenerate, but it kinda somehow still worked because if you long-click on e.g. the popup button, it would call enqueue, but if nothing was running yet it would fallthrough to the very last case and start the player with the video. So let’s return to that and add a TODO for further refactoring in the future.
1 parent ac33816 commit ab6e25d

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

app/src/main/java/org/schabi/newpipe/player/Player.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -396,8 +396,12 @@ public void handleIntent(@NonNull final Intent intent) {
396396
return;
397397
}
398398
playQueue.append(newQueue.getStreams());
399+
return;
399400
}
400-
return;
401+
402+
// TODO: This falls through to the old logic, there was no playQueue
403+
// yet so we should start the player and add the new video
404+
break;
401405
}
402406
case EnqueueNext -> {
403407
if (playQueue != null) {
@@ -407,8 +411,12 @@ public void handleIntent(@NonNull final Intent intent) {
407411
}
408412
final PlayQueueItem newItem = newQueue.getStreams().get(0);
409413
newQueue.enqueueNext(newItem, false);
414+
return;
410415
}
411-
return;
416+
417+
// TODO: This falls through to the old logic, there was no playQueue
418+
// yet so we should start the player and add the new video
419+
break;
412420
}
413421
case TimestampChange -> {
414422
final TimestampChangeData dat = intent.getParcelableExtra(PLAYER_INTENT_DATA);

0 commit comments

Comments
 (0)