Use proper key-value coding method to get the value

This commit is contained in:
Gregory John Casamento 2023-03-20 07:43:57 -04:00
parent 282096f867
commit f3d3dc386b

View file

@ -15,6 +15,9 @@
Author: Gregory John Casamento <greg_casamento@yahoo.com> Author: Gregory John Casamento <greg_casamento@yahoo.com>
Date: October 2001 Date: October 2001
KVO Support Added by greg.casamento@gmail.com.
Date: March 2023
This file is part of the GNUstep GUI Library. This file is part of the GNUstep GUI Library.
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
@ -39,6 +42,7 @@
#import <Foundation/NSEnumerator.h> #import <Foundation/NSEnumerator.h>
#import <Foundation/NSException.h> #import <Foundation/NSException.h>
#import <Foundation/NSIndexSet.h> #import <Foundation/NSIndexSet.h>
#import <Foundation/NSKeyValueCoding.h>
#import <Foundation/NSMapTable.h> #import <Foundation/NSMapTable.h>
#import <Foundation/NSNotification.h> #import <Foundation/NSNotification.h>
#import <Foundation/NSNull.h> #import <Foundation/NSNull.h>
@ -2137,13 +2141,13 @@ Also returns the child index relative to this parent. */
} }
else else
{ {
NSString *countKey = [source countKeyPath]; NSString *countKeyPath = [source countKeyPath];
SEL countSel = NSSelectorFromString(countKey); NSString *childrenKeyPath = [source childrenKeyPath];
NSString *childrenKey = [source childrenKeyPath]; NSNumber *n = nil;
SEL childrenSel = NSSelectorFromString(childrenKey);
contentArray = (NSArray *)[sitem performSelector: childrenSel]; contentArray = (NSArray *)[sitem valueForKey: childrenKeyPath];
num = (NSUInteger)[sitem performSelector: countSel]; n = (NSNumber *)[sitem valueForKey: countKeyPath];
num = [n integerValue];
} }
if (num > 0) if (num > 0)