Prevent NPEs
This commit is contained in:
parent
a2fc5a2b48
commit
9b13e19b66
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
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