Fixed crash when exiting app during playback.

This commit is contained in:
Felix Ableitner 2013-12-13 00:57:18 +01:00
parent bb2d385460
commit d2a8aeeb34
2 changed files with 7 additions and 1 deletions

View file

@ -463,6 +463,10 @@ public class RouteFragment extends MediaRouteDiscoveryFragment implements
* Receives information from MediaRouterPlayService about playback status.
*/
public void receivePlaybackStatus(MediaItemStatus status) {
// Views may not exist if fragment was just created/destroyed.
if (getView() == null)
return;
int currentTime = (int) status.getContentPosition() / 1000;
int totalTime = (int) status.getContentDuration() / 1000;

View file

@ -315,6 +315,8 @@ public class MediaRouterPlayService extends Service {
@Override
public void onResult(Bundle data) {
MediaItemStatus status = MediaItemStatus.fromBundle(data);
if (status == null)
return;
if (mRouterFragment.get() != null)
mRouterFragment.get().receivePlaybackStatus(status);