diff --git a/include/MacStd/CoreFoundation.hpp b/include/MacStd/CoreFoundation.hpp index cc88887..d71c0fa 100644 --- a/include/MacStd/CoreFoundation.hpp +++ b/include/MacStd/CoreFoundation.hpp @@ -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;