#1633 embed predicate evaluation in a @try

This commit is contained in:
Mitchell Livingston 2008-12-26 21:28:59 +00:00
parent 1582135e3c
commit 9e71a10313
1 changed files with 15 additions and 3 deletions

View File

@ -229,7 +229,7 @@ GroupsController * fGroupsInstance = nil;
if (orderIndex == -1)
return nil;
return [[fGroups objectAtIndex: orderIndex] objectForKey: @"AutoGroupRules"];
return [[fGroups objectAtIndex: orderIndex] objectForKey: @"AutoGroupRules"];
}
- (void) setAutoAssignRules: (NSPredicate *) predicate forIndex: (NSInteger) index
@ -429,8 +429,20 @@ GroupsController * fGroupsInstance = nil;
if (![self usesAutoAssignRulesForIndex: index])
return NO;
NSPredicate * predicate = [self autoAssignRulesForIndex: index];
return [predicate evaluateWithObject: torrent];
NSPredicate * predicate = [self autoAssignRulesForIndex: index];
BOOL eval = NO;
@try
{
eval = [predicate evaluateWithObject:torrent];
}
@catch (NSException * exception)
{
NSLog(@"Error when evaluating predicate (%@) - %@", predicate, exception);
}
@finally
{
return eval;
}
}
@end