Changeset 7388


Ignore:
Timestamp:
Dec 14, 2008, 4:16:37 PM (12 years ago)
Author:
livings124
Message:

skip bad rules instead of asserting - this might help down the road if rules are removed/changed

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/GroupsController.m

    r7387 r7388  
    449449        return NO;
    450450   
    451     NSArray * rules = [self autoAssignRulesForIndex: index];
    452     if (!rules || [rules count] == 0)
    453         return NO;
    454    
    455451    const BOOL needAll = [self rulesNeedAllForIndex: index];
    456    
    457     NSEnumerator * iterator = [rules objectEnumerator];
     452    BOOL anyPassed = NO;
     453   
     454    NSEnumerator * iterator = [[self autoAssignRulesForIndex: index] objectEnumerator];
    458455    NSArray * rule = nil;
    459456    while ((rule = [iterator nextObject]))
     
    466463            values = [torrent allTrackers: NO];
    467464        else
    468             NSAssert1(NO, @"\"%@\" - unknown criteria", type);
    469        
    470         BOOL match = NO;
     465            continue;
    471466       
    472467        NSStringCompareOptions options;
     
    478473            options = NSCaseInsensitiveSearch;
    479474        else
    480             NSAssert2(NO, @"\"%@ - %@\" - unknown criteria", type, place);
     475            continue;
     476       
     477        BOOL match = NO;
    481478       
    482479        NSEnumerator * enumerator = [values objectEnumerator];
    483480        NSString * value;
    484         while (!match && (value = [enumerator nextObject]))
     481        while ((value = [enumerator nextObject]))
    485482        {
    486483            NSRange result = [value rangeOfString: givenValue options: options];
    487             match = result.location != NSNotFound;
     484            if (result.location != NSNotFound)
     485            {
     486                match = YES;
     487                anyPassed = YES;
     488                break;
     489            }
    488490        }
    489491       
     
    495497    }
    496498   
    497     return needAll;
     499    return anyPassed && needAll;
    498500}
    499501
Note: See TracChangeset for help on using the changeset viewer.