connectivity/source/drivers/macab/MacabRecords.cxx | 22 +++++++++++++++++++++ 1 file changed, 22 insertions(+)
New commits: commit 4ba9ce97c90f6b3766fa7258a301e998d51ee94b Author: Dan Williams <[email protected]> AuthorDate: Tue Sep 16 21:20:08 2025 -0500 Commit: Xisco Fauli <[email protected]> CommitDate: Mon Sep 29 16:19:27 2025 +0200 connectivity/macab: avoid errors due to missing contacts.notes entitlement Accessing an address book contact's Note field requires an entitlement since Mac OS 13. Without that entitlement the following error occurs: CoreData: error: Unhandled error occurred during faulting: Error Domain=NSCocoaErrorDomain Code=134092 "(null)" It seems unlikely that the Note field functionality is widely used for anything the address book functionality is used for, so just ignore the field entirely. Signed-off-by: Dan Williams <[email protected]> Change-Id: I694f3ac40a8dccb49f51818dcdb3da7948f560d5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191057 Reviewed-by: Patrick Luby <[email protected]> Tested-by: Jenkins (cherry picked from commit 15ee3a463768810b438d558533a3baca0700d690) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191291 Reviewed-by: Noel Grandin <[email protected]> Reviewed-by: Xisco Fauli <[email protected]> Tested-by: Xisco Fauli <[email protected]> diff --git a/connectivity/source/drivers/macab/MacabRecords.cxx b/connectivity/source/drivers/macab/MacabRecords.cxx index a4f2c61a8b0c..0d70552b3cdc 100644 --- a/connectivity/source/drivers/macab/MacabRecords.cxx +++ b/connectivity/source/drivers/macab/MacabRecords.cxx @@ -321,6 +321,21 @@ void MacabRecords::bootstrap_requiredProperties() kABAddressProperty, kABPhoneProperty, kABEmailProperty}; } +bool shouldSkipProperty(CFStringRef propertyName) +{ + /* Skip Note property to help prevent the following exception: + * + * CoreData: error: Unhandled error occurred during faulting: Error Domain=NSCocoaErrorDomain Code=134092 "(null)" + * + * which occurs because we do not have an entitlement to access contact notes. + * See https://developer.apple.com/documentation/bundleresources/entitlements/com.apple.developer.contacts.notes + * for more details. + */ + if (CFStringCompare(propertyName, CFSTR("Note"), 0) == kCFCompareEqualTo) + return true; + + return false; +} /* Create the header for a given record type and a given array of records. * Because the array of records and the record type are given, if you want @@ -457,6 +472,9 @@ MacabHeader *MacabRecords::createHeaderForRecordType(const CFArrayRef _records, for(sal_Int32 j = 0; j < numNonRequiredProperties; j++) { property = nonRequiredProperties[j]; + if (shouldSkipProperty(property)) + continue; + headerDataForProperty = createHeaderForProperty(record,property,_recordType,false); if(headerDataForProperty != nullptr) { @@ -853,11 +871,15 @@ MacabRecord *MacabRecords::createMacabRecord(const ABRecordRef _abrecord, const for(i = 0; i < numProperties; i++) { propertyName = static_cast<CFStringRef>(CFArrayGetValueAtIndex(recordProperties, i)); + if (shouldSkipProperty(propertyName)) + continue; + localizedPropertyName = ABCopyLocalizedPropertyOrLabel(propertyName); propertyNameString = CFStringToOUString(localizedPropertyName); CFRelease(localizedPropertyName); /* Get the property's value */ + propertyValue = ABRecordCopyValue(_abrecord,propertyName); if(propertyValue != nullptr) {
