Check the result of CFStringGetCStringPtr before assigning it to an std::string.

This commit is contained in:
casey langen 2019-01-17 19:49:57 -08:00
parent 926b5bebea
commit b2c6b34a7b

View File

@ -392,7 +392,10 @@ IDeviceList* CoreAudioOut::GetDeviceList() {
CFStringRef deviceUid;
if (AudioObjectGetPropertyData(deviceId, &uidAddress, 0, NULL, &propsize, &deviceUid) == 0) {
deviceIdStr = CFStringGetCStringPtr(deviceUid, kCFStringEncodingUTF8);
const char* cstr = CFStringGetCStringPtr(deviceUid, kCFStringEncodingUTF8);
if (cstr) {
deviceIdStr = cstr;
}
}
if (deviceNameStr.size() && deviceIdStr.size()) {