summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordaniel oeh <daniel.oeh@gmail.com>2012-09-26 21:21:04 +0200
committerdaniel oeh <daniel.oeh@gmail.com>2012-09-26 21:21:04 +0200
commit891f2e09f498096296e3d6f28cc41c20d160b335 (patch)
treec905ea507324c1d688264e8ded4f246b7571a283 /src
parent258a6acd6eda93c9921d551b6c5e528dc6f9e40c (diff)
downloadAntennaPod-891f2e09f498096296e3d6f28cc41c20d160b335.zip
Fixed possible nullpointerexception in onPositionObserverUpdate()
Diffstat (limited to 'src')
-rw-r--r--src/de/danoeh/antennapod/activity/MediaplayerActivity.java27
1 files changed, 15 insertions, 12 deletions
diff --git a/src/de/danoeh/antennapod/activity/MediaplayerActivity.java b/src/de/danoeh/antennapod/activity/MediaplayerActivity.java
index 45c5f55a5..39f30c95e 100644
--- a/src/de/danoeh/antennapod/activity/MediaplayerActivity.java
+++ b/src/de/danoeh/antennapod/activity/MediaplayerActivity.java
@@ -317,18 +317,21 @@ public abstract class MediaplayerActivity extends SherlockFragmentActivity
protected abstract void clearStatusMsg();
protected void onPositionObserverUpdate() {
- int currentPosition = controller.getPosition();
- int duration = controller.getDuration();
- if (currentPosition != PlaybackService.INVALID_TIME
- && duration != PlaybackService.INVALID_TIME) {
- controller.getMedia().setPosition(currentPosition);
- txtvPosition.setText(Converter
- .getDurationStringLong(currentPosition));
- txtvLength.setText(Converter.getDurationStringLong(duration));
- updateProgressbarPosition(currentPosition, duration);
- } else {
- Log.w(TAG,
- "Could not react to position observer update because of invalid time");
+ if (controller != null) {
+ int currentPosition = controller.getPosition();
+ int duration = controller.getDuration();
+ if (currentPosition != PlaybackService.INVALID_TIME
+ && duration != PlaybackService.INVALID_TIME
+ && controller.getMedia() != null) {
+ controller.getMedia().setPosition(currentPosition);
+ txtvPosition.setText(Converter
+ .getDurationStringLong(currentPosition));
+ txtvLength.setText(Converter.getDurationStringLong(duration));
+ updateProgressbarPosition(currentPosition, duration);
+ } else {
+ Log.w(TAG,
+ "Could not react to position observer update because of invalid time");
+ }
}
}