Changeset 3604

Show
Ignore:
Timestamp:
03/06/07 21:06:58 (1 year ago)
Author:
timothy
Message:

Fixes an exception if NSSpeechSynthesizer initWithVoice: returns nil.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Controllers/JVSpeechController.m

    r3418 r3604  
    1313        if( ( self = [super init] ) ) { 
    1414                _speechQueue = [[NSMutableArray alloc] initWithCapacity:15]; 
    15                 _synthesizers = [[NSArray alloc] initWithObjects:[[[NSSpeechSynthesizer alloc] init] autorelease], [[[NSSpeechSynthesizer alloc] init] autorelease], [[[NSSpeechSynthesizer alloc] init] autorelease], nil]; 
     15                _synthesizers = [[NSArray alloc] initWithObjects:[[[NSSpeechSynthesizer alloc] initWithVoice:nil] autorelease], [[[NSSpeechSynthesizer alloc] initWithVoice:nil] autorelease], [[[NSSpeechSynthesizer alloc] initWithVoice:nil] autorelease], nil]; 
    1616 
    17                 for( int i = 0; i < 3; i++ ) 
     17                for( unsigned i = 0; i < [_synthesizers count]; i++ ) 
    1818                        [[_synthesizers objectAtIndex:i] setDelegate:self]; 
    1919        } 
     
    3333 
    3434- (void) startSpeakingString:(NSString *) string usingVoice:(NSString *) voice { 
    35         for( int i = 0; i < 3; i++ ) { 
     35        for( unsigned i = 0; i < [_synthesizers count]; i++ ) { 
    3636                NSSpeechSynthesizer *synth = [_synthesizers objectAtIndex:i]; 
    3737                if( ! [synth isSpeaking] ) {