Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion app/src/main/java/org/schabi/newpipe/player/Player.java
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,8 @@ public final class Player implements
// Playback
//////////////////////////////////////////////////////////////////////////*/

private PlayQueue playQueue;
// play queue might be null e.g. while player is starting
@Nullable private PlayQueue playQueue;
private PlayQueueAdapter playQueueAdapter;
private StreamSegmentAdapter segmentAdapter;

Expand Down Expand Up @@ -4202,6 +4203,7 @@ public boolean popupPlayerSelected() {
}


@Nullable
public PlayQueue getPlayQueue() {
return playQueue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ public static synchronized PlayerHolder getInstance() {
private static final boolean DEBUG = MainActivity.DEBUG;
private static final String TAG = PlayerHolder.class.getSimpleName();

private PlayerServiceExtendedEventListener listener;
@Nullable private PlayerServiceExtendedEventListener listener;

private final PlayerServiceConnection serviceConnection = new PlayerServiceConnection();
private boolean bound;
private MainPlayer playerService;
private Player player;
@Nullable private MainPlayer playerService;
@Nullable private Player player;

/**
* Returns the current {@link MainPlayer.PlayerType} of the {@link MainPlayer} service,
Expand Down Expand Up @@ -75,7 +75,11 @@ public boolean isBound() {
}

public int getQueueSize() {
return isPlayerOpen() ? player.getPlayQueue().size() : 0;
if (player == null || player.getPlayQueue() == null) {
// player play queue might be null e.g. while player is starting
return 0;
}
return player.getPlayQueue().size();
}

public void setListener(@Nullable final PlayerServiceExtendedEventListener newListener) {
Expand Down