[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 <kode54@gmail.com>
swiftingly
Christopher Snowhill 2022-06-17 08:24:19 -07:00
parent 7cf6a7e03b
commit 5a6295be1e
1 changed files with 3 additions and 1 deletions

View File

@ -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);