From 76d612faf4b40c6ae603fecaa6710bd68279e0e7 Mon Sep 17 00:00:00 2001 From: Christopher Snowhill Date: Fri, 15 Jul 2022 22:51:59 -0700 Subject: [PATCH] [Audio Output] Only unregister listener if used Only unregister the listener if it actually has been registered, and clear the handle upon doing so. Signed-off-by: Christopher Snowhill --- Audio/Output/OutputAVFoundation.m | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Audio/Output/OutputAVFoundation.m b/Audio/Output/OutputAVFoundation.m index 9949fc37f..bf8c9a45f 100644 --- a/Audio/Output/OutputAVFoundation.m +++ b/Audio/Output/OutputAVFoundation.m @@ -1126,7 +1126,10 @@ current_device_listener(AudioObjectID inObjectID, UInt32 inNumberAddresses, cons } - (void)removeSynchronizerBlock { - [renderSynchronizer removeTimeObserver:currentPtsObserver]; + if(renderSynchronizer && currentPtsObserver) { + [renderSynchronizer removeTimeObserver:currentPtsObserver]; + currentPtsObserver = nil; + } } - (void)setVolume:(double)v {