Re: NSTableView searching and predicates
Re: NSTableView searching and predicates
- Subject: Re: NSTableView searching and predicates
- From: mmalc crawford <email@hidden>
- Date: Sat, 4 Aug 2007 17:35:26 -0700
On Aug 4, 2007, at 4:44 PM, Andrew Farmer wrote:
NSPredicate *myFilterPredicate;
NSString *mySearchString = [sender stringValue];
if (mySearchString != nil)
{
myFilterPredicate = [NSPredicate predicateWithFormat:
@"%@ IN[cd] myEvent || %@ IN[cd] myNotes", mySearchString,
mySearchString];
}
[self setFilterPredicate:myFilterPredicate];
[self rearrangeObjects];
}
That'll run [self setFilterPredicate:] on an uninitialized variable
if mySearchString is nil. The third line should probably be:
NSPredicate *myFilterPredicate = [NSPredicate
predicateWithValue:YES];
in order to get identical behavior to the original.
Mea culpa (the perils of typing code in Mail), I omitted the
initialisation. It should, though, be:
NSPredicate *myFilterPredicate = nil;
mmalc
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please 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