From c97fb13361dbd4d7fa270ef91710bd0d7cd9ea3c Mon Sep 17 00:00:00 2001 From: Martin Fietz Date: Fri, 3 Jun 2016 11:47:04 +0200 Subject: [PATCH] Prevent NPE --- .../danoeh/antennapod/activity/VideoplayerActivity.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/de/danoeh/antennapod/activity/VideoplayerActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/VideoplayerActivity.java index a4ffebae2..8531a7356 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/VideoplayerActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/VideoplayerActivity.java @@ -112,7 +112,7 @@ public class VideoplayerActivity extends MediaplayerActivity { @Override protected boolean loadMediaInfo() { - if (!super.loadMediaInfo()) { + if (!super.loadMediaInfo() || controller == null) { return false; } Playable media = controller.getMedia(); @@ -152,7 +152,7 @@ public class VideoplayerActivity extends MediaplayerActivity { @Override protected void onAwaitingVideoSurface() { - if (videoSurfaceCreated) { + if (videoSurfaceCreated && controller != null) { Log.d(TAG, "Videosurface already created, setting videosurface now"); Pair videoSize = controller.getVideoSize(); @@ -240,7 +240,7 @@ public class VideoplayerActivity extends MediaplayerActivity { public void surfaceCreated(SurfaceHolder holder) { Log.d(TAG, "Videoview holder created"); videoSurfaceCreated = true; - if (controller.getStatus() == PlayerStatus.PLAYING) { + if (controller != null && controller.getStatus() == PlayerStatus.PLAYING) { if (controller.serviceAvailable()) { controller.setVideoSurface(holder); } else { @@ -254,7 +254,7 @@ public class VideoplayerActivity extends MediaplayerActivity { public void surfaceDestroyed(SurfaceHolder holder) { Log.d(TAG, "Videosurface was destroyed"); videoSurfaceCreated = false; - if (!destroyingDueToReload) { + if (controller != null && !destroyingDueToReload) { controller.notifyVideoSurfaceAbandoned(); } }