Skip to content

Commit

Permalink
prevent exceptions with empty media URIs
Browse files Browse the repository at this point in the history
  • Loading branch information
robb1e authored and shazron committed Aug 27, 2009
1 parent f460ee2 commit 49f827c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion iphone/Classes/Sound.m
Expand Up @@ -14,11 +14,15 @@ @implementation Sound

- (void) play:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options
{
if([[arguments objectAtIndex:0] isEqualToString:@""]){
NSLog(@"Cannot play empty URI");
return;
}
NSUInteger argc = [arguments count];

if (argc > 1) self.successCallback = [arguments objectAtIndex:1];
if (argc > 2) self.errorCallback = [arguments objectAtIndex:2];

NSBundle * mainBundle = [NSBundle mainBundle];
NSMutableArray *directoryParts = [NSMutableArray arrayWithArray:[(NSString*)[arguments objectAtIndex:0] componentsSeparatedByString:@"/"]];
NSString *filename = [directoryParts lastObject];
Expand Down

0 comments on commit 49f827c

Please sign in to comment.