We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
- (NSString *)propertyNameForObject:(NSObject *)object byCaseInsensitivePropertyName:(NSString *)caseInsensitivePropertyName { NSString *result = nil; Class currentClass = [object class]; NSString *key = [NSString stringWithFormat:@"%@.%@", NSStringFromClass(currentClass), caseInsensitivePropertyName]; if (self.propertyNameDictionary[key]) return self.propertyNameDictionary[key]; while (currentClass && currentClass != [NSObject class]) { unsigned int outCount, i; objc_property_t *properties = class_copyPropertyList(currentClass, &outCount); for (i = 0; i < outCount; i++) { objc_property_t property = properties[i]; NSString *propertyName = [NSString stringWithUTF8String:property_getName(property)]; if ([[propertyName lowercaseString] isEqual:[caseInsensitivePropertyName lowercaseString]]) { result = propertyName; break; } } free(properties); if (result) { self.propertyNameDictionary[key] = result; return result; } currentClass = class_getSuperclass(currentClass); } return nil; }
Do a null check on properties before calling free Also do a null check for key?
properties
free
key
The text was updated successfully, but these errors were encountered:
aryaxt
No branches or pull requests
Do a null check on
properties
before callingfree
Also do a null check for
key
?The text was updated successfully, but these errors were encountered: