CoreFoundation: Use explicit handle validation
Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
parent
0ffa0edfac
commit
3fe0006b22
@ -87,14 +87,14 @@ namespace macstd {
|
||||
static std::string message(CFErrorRef error)
|
||||
{
|
||||
macstd::cfstring description(CFErrorCopyDescription(error));
|
||||
if (description && CFStringGetLength(description) > 0) {
|
||||
if (description.valid() && CFStringGetLength(description) > 0) {
|
||||
auto str = CFStringGetCStringPtr(description, kCFStringEncodingUTF8);
|
||||
if (str)
|
||||
return str;
|
||||
}
|
||||
std::string msg("Core Foundation error " + std::to_string(CFErrorGetCode(error)));
|
||||
macstd::cfstring domain(CFErrorGetDomain(error));
|
||||
if (domain && CFStringGetLength(domain) > 0) {
|
||||
if (domain.valid() && CFStringGetLength(domain) > 0) {
|
||||
auto str = CFStringGetCStringPtr(domain, kCFStringEncodingUTF8);
|
||||
if (str)
|
||||
msg += std::string(", domain ") + str;
|
||||
|
Loading…
x
Reference in New Issue
Block a user