mirror of
https://github.com/AntennaPod/AntennaPod.git
synced 2024-12-23 15:30:35 +01:00
Merge pull request #2044 from mfietz/issue/2043-mediaplayeract-npe
MediaplayerActivity & MediaplayerInfoActivity: Prevent NPEs
This commit is contained in:
commit
d5e63cb52c
@ -630,17 +630,16 @@ public abstract class MediaplayerActivity extends CastEnabledActivity implements
|
||||
*/
|
||||
protected boolean loadMediaInfo() {
|
||||
Log.d(TAG, "loadMediaInfo()");
|
||||
if(controller == null || controller.getMedia() == null) {
|
||||
return false;
|
||||
}
|
||||
Playable media = controller.getMedia();
|
||||
SharedPreferences prefs = getSharedPreferences(PREFS, MODE_PRIVATE);
|
||||
showTimeLeft = prefs.getBoolean(PREF_SHOW_TIME_LEFT, false);
|
||||
if (media != null) {
|
||||
onPositionObserverUpdate();
|
||||
checkFavorite();
|
||||
updatePlaybackSpeedButton();
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
onPositionObserverUpdate();
|
||||
checkFavorite();
|
||||
updatePlaybackSpeedButton();
|
||||
return true;
|
||||
}
|
||||
|
||||
protected void updatePlaybackSpeedButton() {
|
||||
|
@ -277,7 +277,7 @@ public abstract class MediaplayerInfoActivity extends MediaplayerActivity implem
|
||||
if (!super.loadMediaInfo()) {
|
||||
return false;
|
||||
}
|
||||
if(controller.getMedia() != media) {
|
||||
if(controller != null && controller.getMedia() != media) {
|
||||
media = controller.getMedia();
|
||||
pagerAdapter.onMediaChanged(media);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user