From 536a1a236f67a304af266146f36b8eac41b40bda Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Fri, 28 Mar 2025 18:39:16 -0400
Subject: [PATCH] coreaudio: Added some NULL pointer checks.
These might not be necessary, just trying to track down a reported issue.
Reference Issue #12660.
---
src/audio/coreaudio/SDL_coreaudio.m | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/audio/coreaudio/SDL_coreaudio.m b/src/audio/coreaudio/SDL_coreaudio.m
index 57b19c7266701..e7d9e58a392d9 100644
--- a/src/audio/coreaudio/SDL_coreaudio.m
+++ b/src/audio/coreaudio/SDL_coreaudio.m
@@ -341,7 +341,7 @@ static void ResumeAudioDevices(void)
static void InterruptionBegin(SDL_AudioDevice *device)
{
- if (device != NULL && device->hidden->audioQueue != NULL) {
+ if (device != NULL && device->hidden != NULL && device->hidden->audioQueue != NULL) {
device->hidden->interrupted = true;
AudioQueuePause(device->hidden->audioQueue);
}
@@ -366,7 +366,7 @@ - (void)audioSessionInterruption:(NSNotification *)note
{
@synchronized(self) {
NSNumber *type = note.userInfo[AVAudioSessionInterruptionTypeKey];
- if (type.unsignedIntegerValue == AVAudioSessionInterruptionTypeBegan) {
+ if (type && (type.unsignedIntegerValue == AVAudioSessionInterruptionTypeBegan)) {
InterruptionBegin(self.device);
} else {
InterruptionEnd(self.device);