mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-07 23:35:03 +01:00
properly handle empty CFStringRefs.
This commit is contained in:
parent
23a6526de7
commit
95631cdc25
1 changed files with 5 additions and 1 deletions
|
|
@ -46,7 +46,11 @@ static void midiInputCallback(const MIDIPacketList *list, void *procRef, void *s
|
||||||
static std::string getDisplayName(MIDIObjectRef object)
|
static std::string getDisplayName(MIDIObjectRef object)
|
||||||
{
|
{
|
||||||
CFStringRef name = nil;
|
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 "";
|
return "";
|
||||||
}
|
}
|
||||||
std::string rv (CFStringGetCStringPtr(name, kCFStringEncodingUTF8));
|
std::string rv (CFStringGetCStringPtr(name, kCFStringEncodingUTF8));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue