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() {
|
protected boolean loadMediaInfo() {
|
||||||
Log.d(TAG, "loadMediaInfo()");
|
Log.d(TAG, "loadMediaInfo()");
|
||||||
|
if(controller == null || controller.getMedia() == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
Playable media = controller.getMedia();
|
Playable media = controller.getMedia();
|
||||||
SharedPreferences prefs = getSharedPreferences(PREFS, MODE_PRIVATE);
|
SharedPreferences prefs = getSharedPreferences(PREFS, MODE_PRIVATE);
|
||||||
showTimeLeft = prefs.getBoolean(PREF_SHOW_TIME_LEFT, false);
|
showTimeLeft = prefs.getBoolean(PREF_SHOW_TIME_LEFT, false);
|
||||||
if (media != null) {
|
|
||||||
onPositionObserverUpdate();
|
onPositionObserverUpdate();
|
||||||
checkFavorite();
|
checkFavorite();
|
||||||
updatePlaybackSpeedButton();
|
updatePlaybackSpeedButton();
|
||||||
return true;
|
return true;
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void updatePlaybackSpeedButton() {
|
protected void updatePlaybackSpeedButton() {
|
||||||
|
|
|
@ -277,7 +277,7 @@ public abstract class MediaplayerInfoActivity extends MediaplayerActivity implem
|
||||||
if (!super.loadMediaInfo()) {
|
if (!super.loadMediaInfo()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if(controller.getMedia() != media) {
|
if(controller != null && controller.getMedia() != media) {
|
||||||
media = controller.getMedia();
|
media = controller.getMedia();
|
||||||
pagerAdapter.onMediaChanged(media);
|
pagerAdapter.onMediaChanged(media);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue