Assign class member in StyledPlayerControlView before using it

The local tracks variable was used to assign the initial subtext
for the current track selection in the menu, but the new value
was only assigned after the subtext has been evaluated.

Assign the local variable first, so that the remaining accesses
the latest value.

Issue: google/ExoPlayer#9698
PiperOrigin-RevId: 410750396
This commit is contained in:
tonihei 2021-11-18 10:41:49 +00:00 committed by Ian Baker
parent e1e54b3e15
commit b42f90c247

View File

@ -2077,6 +2077,7 @@ public class StyledPlayerControlView extends FrameLayout {
@Override
public void init(List<TrackInformation> trackInformations) {
this.tracks = trackInformations;
// Update subtext in settings menu with current audio track selection.
TrackSelectionParameters params = checkNotNull(player).getTrackSelectionParameters();
if (trackInformations.isEmpty()) {
@ -2099,7 +2100,6 @@ public class StyledPlayerControlView extends FrameLayout {
}
}
}
this.tracks = trackInformations;
}
}