From 78f2da405f975a13820a217d89a2d9b6a8f71535 Mon Sep 17 00:00:00 2001 From: Lee Braiden Date: Mon, 15 Apr 2019 19:09:56 +0100 Subject: [PATCH] Fix potential NPE in AlarmSoundService destructor. --- .../nightscout/androidaps/services/AlarmSoundService.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/services/AlarmSoundService.java b/app/src/main/java/info/nightscout/androidaps/services/AlarmSoundService.java index e95cd7c479..4917789db1 100644 --- a/app/src/main/java/info/nightscout/androidaps/services/AlarmSoundService.java +++ b/app/src/main/java/info/nightscout/androidaps/services/AlarmSoundService.java @@ -75,8 +75,11 @@ public class AlarmSoundService extends Service { @Override public void onDestroy() { - player.stop(); - player.release(); + if (player != null) { + player.stop(); + player.release(); + } + if (L.isEnabled(L.CORE)) log.debug("onDestroy"); }