From 83898c81cdffab04f65fcb68ff50c867636ba16c Mon Sep 17 00:00:00 2001 From: dhk2 Date: Fri, 3 Jul 2020 22:06:38 -0700 Subject: [PATCH] Bug fix for DateUtils not working as documented --- .../schueller/peertube/service/VideoPlayerService.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 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 d100402..d3aa9a8 100644 --- a/app/src/main/java/net/schueller/peertube/service/VideoPlayerService.java +++ b/app/src/main/java/net/schueller/peertube/service/VideoPlayerService.java @@ -132,9 +132,12 @@ public class VideoPlayerService extends Service { playerNotificationManager.setPlayer(null); } //Was seeing an error when exiting the program about about not unregistering the receiver. - if (null!=myNoisyAudioStreamReceiver) { - this.unregisterReceiver(myNoisyAudioStreamReceiver); - myNoisyAudioStreamReceiver=null; + try { + if (null!=myNoisyAudioStreamReceiver) { + this.unregisterReceiver(myNoisyAudioStreamReceiver); + } + } catch (Exception e) { + Log.e("VideoPlayerService", "attempted to unregister a nonregistered service"); } if (player != null) { player.release();