Fix NPE in applyReplayGain

refreshReplayGainValues may get called from onSharedPreferenceChanged where we didn't yet prepare a media player.
Ensure that refreshReplayGainValues() does not trigger an update in such situations, as there is nothing to refresh.
This commit is contained in:
Adrian Ulrich 2017-11-14 22:01:20 +01:00
parent f631fb873d
commit cc9b738cc4

View File

@ -684,8 +684,12 @@ public final class PlaybackService extends Service
* the (maybe just changed) user settings
*/
private void refreshReplayGainValues() {
applyReplayGain(mMediaPlayer);
applyReplayGain(mPreparedMediaPlayer);
if (mMediaPlayer != null) {
applyReplayGain(mMediaPlayer);
}
if (mPreparedMediaPlayer != null) {
applyReplayGain(mPreparedMediaPlayer);
}
}
private void refreshDuckingValues() {