Fixed possible nullpointerexception in onPositionObserverUpdate()
This commit is contained in:
parent
258a6acd6e
commit
891f2e09f4
|
@ -317,10 +317,12 @@ public abstract class MediaplayerActivity extends SherlockFragmentActivity
|
||||||
protected abstract void clearStatusMsg();
|
protected abstract void clearStatusMsg();
|
||||||
|
|
||||||
protected void onPositionObserverUpdate() {
|
protected void onPositionObserverUpdate() {
|
||||||
|
if (controller != null) {
|
||||||
int currentPosition = controller.getPosition();
|
int currentPosition = controller.getPosition();
|
||||||
int duration = controller.getDuration();
|
int duration = controller.getDuration();
|
||||||
if (currentPosition != PlaybackService.INVALID_TIME
|
if (currentPosition != PlaybackService.INVALID_TIME
|
||||||
&& duration != PlaybackService.INVALID_TIME) {
|
&& duration != PlaybackService.INVALID_TIME
|
||||||
|
&& controller.getMedia() != null) {
|
||||||
controller.getMedia().setPosition(currentPosition);
|
controller.getMedia().setPosition(currentPosition);
|
||||||
txtvPosition.setText(Converter
|
txtvPosition.setText(Converter
|
||||||
.getDurationStringLong(currentPosition));
|
.getDurationStringLong(currentPosition));
|
||||||
|
@ -331,6 +333,7 @@ public abstract class MediaplayerActivity extends SherlockFragmentActivity
|
||||||
"Could not react to position observer update because of invalid time");
|
"Could not react to position observer update because of invalid time");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void updateProgressbarPosition(int position, int duration) {
|
private void updateProgressbarPosition(int position, int duration) {
|
||||||
if (AppConfig.DEBUG)
|
if (AppConfig.DEBUG)
|
||||||
|
|
Loading…
Reference in New Issue