From 3fe0006b22142959237150bce8fe1432cfb51c5c Mon Sep 17 00:00:00 2001 From: Simon Rozman Date: Tue, 17 Jun 2025 16:32:00 +0200 Subject: [PATCH] CoreFoundation: Use explicit handle validation Signed-off-by: Simon Rozman --- include/MacStd/CoreFoundation.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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;