From 5a6295be1e2903673f31e3546adc115381852c63 Mon Sep 17 00:00:00 2001 From: Christopher Snowhill Date: Fri, 17 Jun 2022 08:24:19 -0700 Subject: [PATCH] [Core Audio Output] Fix possible bug in enumerator Fix a potential bug where the device enumerator would return a nil device name string, which would result in a crash. Instead, report an unknown numbered device. Signed-off-by: Christopher Snowhill --- Audio/Output/OutputCoreAudio.m | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Audio/Output/OutputCoreAudio.m b/Audio/Output/OutputCoreAudio.m index 39d330daf..fe47109bc 100644 --- a/Audio/Output/OutputCoreAudio.m +++ b/Audio/Output/OutputCoreAudio.m @@ -546,7 +546,9 @@ current_device_listener(AudioObjectID inObjectID, UInt32 inNumberAddresses, cons } BOOL stop = NO; - block([NSString stringWithString:(__bridge NSString *)name], + NSString *deviceName = name ? [NSString stringWithString:(__bridge NSString *)name] : [NSString stringWithFormat:@"Unknown device %u", (unsigned int)devids[i]]; + + block(deviceName, devids[i], systemDefault, &stop);