From b21b4e945d0d3733e1f3b61d073913cd46f2523f Mon Sep 17 00:00:00 2001 From: lishoujun Date: Mon, 31 Dec 2018 14:50:52 +0800 Subject: [PATCH] add null check to playerNotificationManager and player on Destroy --- .../peertube/service/VideoPlayerService.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/net/schueller/peertube/service/VideoPlayerService.java b/app/src/main/java/net/schueller/peertube/service/VideoPlayerService.java index c23c7d1..bc62ddb 100644 --- a/app/src/main/java/net/schueller/peertube/service/VideoPlayerService.java +++ b/app/src/main/java/net/schueller/peertube/service/VideoPlayerService.java @@ -118,11 +118,13 @@ public class VideoPlayerService extends Service { public void onDestroy() { Log.v(TAG, "onDestroy..."); - - playerNotificationManager.setPlayer(null); - player.release(); - player = null; - + if (playerNotificationManager != null) { + playerNotificationManager.setPlayer(null); + } + if (player != null) { + player.release(); + player = null; + } super.onDestroy(); }