13
0

properly handle empty CFStringRefs.

This commit is contained in:
Robin Gareus 2015-03-08 01:38:47 +01:00
parent 23a6526de7
commit 95631cdc25

View File

@ -46,7 +46,11 @@ static void midiInputCallback(const MIDIPacketList *list, void *procRef, void *s
static std::string getDisplayName(MIDIObjectRef object)
{
CFStringRef name = nil;
if (noErr != MIDIObjectGetStringProperty(object, kMIDIPropertyDisplayName, &name) && name) {
if (noErr != MIDIObjectGetStringProperty(object, kMIDIPropertyDisplayName, &name)) {
return "";
}
if (!CFStringGetCStringPtr(name, kCFStringEncodingUTF8)) {
if (name) CFRelease(name);
return "";
}
std::string rv (CFStringGetCStringPtr(name, kCFStringEncodingUTF8));