add null check to playerNotificationManager and player on Destroy

This commit is contained in:
lishoujun 2018-12-31 14:50:52 +08:00
parent 55f2c07321
commit b21b4e945d

View File

@ -118,11 +118,13 @@ public class VideoPlayerService extends Service {
public void onDestroy() { public void onDestroy() {
Log.v(TAG, "onDestroy..."); Log.v(TAG, "onDestroy...");
if (playerNotificationManager != null) {
playerNotificationManager.setPlayer(null); playerNotificationManager.setPlayer(null);
player.release(); }
player = null; if (player != null) {
player.release();
player = null;
}
super.onDestroy(); super.onDestroy();
} }