Re: Is this a bug of the Cocoa or the Objective-C?
Re: Is this a bug of the Cocoa or the Objective-C?
- Subject: Re: Is this a bug of the Cocoa or the Objective-C?
- From: Jérome Laurens <email@hidden>
- Date: Fri, 26 Jan 2007 14:02:10 +0100
Le 26 janv. 07 à 05:58, JongAm Park a écrit :
Hello,
I have a strange problem.
Here is the code that shows the problem.
while( item = [objectsEnumerator nextObject] ) {
keyString = [item valueForKeyPath:@"CF_EncodingName"];
theRange = [keyString rangeOfString:searchString
options:NSLiteralSearch];
if( theRange.location != NSNotFound ){
[filteredObjects addObject:item];
}
}
you'd better test for theRange.length>0
That way, if keyString is nil, theRange.length is 0, as explained by
Nick Zitzmann, and you test is consistent
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden