Fix a crash with embedded cue sheet handling
Tag reading can read cue sheets as either a single NSString, or an NSArray of NSStrings, so handle either case. Signed-off-by: Christopher Snowhill <kode54@gmail.com>main
parent
cddf9fb9ba
commit
e4bc5853ad
|
@ -50,11 +50,34 @@
|
|||
|
||||
NSDictionary *alsoMetadata = [NSClassFromString(@"AudioPropertiesReader") propertiesForURL:url skipCue:YES];
|
||||
|
||||
NSString *sheet = [fileMetadata objectForKey:@"cuesheet"];
|
||||
if(!sheet || ![sheet length]) sheet = [alsoMetadata objectForKey:@"cuesheet"];
|
||||
id sheet = [fileMetadata objectForKey:@"cuesheet"];
|
||||
NSString *sheetString = nil;
|
||||
if(sheet) {
|
||||
if([sheet isKindOfClass:[NSArray class]]) {
|
||||
NSArray *sheetContainer = sheet;
|
||||
if([sheetContainer count]) {
|
||||
sheetString = sheetContainer[0];
|
||||
}
|
||||
} else if([sheet isKindOfClass:[NSString class]]) {
|
||||
sheetString = sheet;
|
||||
}
|
||||
}
|
||||
if(!sheetString || ![sheetString length]) {
|
||||
sheet = [alsoMetadata objectForKey:@"cuesheet"];
|
||||
if(sheet) {
|
||||
if([sheet isKindOfClass:[NSArray class]]) {
|
||||
NSArray *sheetContainer = sheet;
|
||||
if([sheetContainer count]) {
|
||||
sheetString = sheetContainer[0];
|
||||
}
|
||||
} else if([sheet isKindOfClass:[NSString class]]) {
|
||||
sheetString = sheet;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if([sheet length]) {
|
||||
cuesheet = [CueSheet cueSheetWithString:sheet withFilename:[url path]];
|
||||
if(sheetString && [sheetString length]) {
|
||||
cuesheet = [CueSheet cueSheetWithString:sheetString withFilename:[url path]];
|
||||
}
|
||||
embedded = YES;
|
||||
} else
|
||||
|
|
|
@ -92,11 +92,34 @@ static void *kCueSheetDecoderContext = &kCueSheetDecoderContext;
|
|||
|
||||
NSDictionary *alsoMetadata = [decoder metadata];
|
||||
|
||||
NSString *sheet = [fileMetadata objectForKey:@"cuesheet"];
|
||||
if(!sheet || ![sheet length]) sheet = [alsoMetadata objectForKey:@"cuesheet"];
|
||||
id sheet = [fileMetadata objectForKey:@"cuesheet"];
|
||||
NSString *sheetString = nil;
|
||||
if(sheet) {
|
||||
if([sheet isKindOfClass:[NSArray class]]) {
|
||||
NSArray *sheetContainer = sheet;
|
||||
if([sheetContainer count]) {
|
||||
sheetString = sheetContainer[0];
|
||||
}
|
||||
} else if([sheet isKindOfClass:[NSString class]]) {
|
||||
sheetString = sheet;
|
||||
}
|
||||
}
|
||||
if(!sheetString || ![sheetString length]) {
|
||||
sheet = [alsoMetadata objectForKey:@"cuesheet"];
|
||||
if(sheet) {
|
||||
if([sheet isKindOfClass:[NSArray class]]) {
|
||||
NSArray *sheetContainer = sheet;
|
||||
if([sheetContainer count]) {
|
||||
sheetString = sheetContainer[0];
|
||||
}
|
||||
} else if([sheet isKindOfClass:[NSString class]]) {
|
||||
sheetString = sheet;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if([sheet length]) {
|
||||
cuesheet = [CueSheet cueSheetWithString:sheet withFilename:[url path]];
|
||||
if(sheetString && [sheetString length]) {
|
||||
cuesheet = [CueSheet cueSheetWithString:sheetString withFilename:[url path]];
|
||||
embedded = YES;
|
||||
}
|
||||
|
||||
|
|
|
@ -46,11 +46,34 @@
|
|||
|
||||
NSDictionary *alsoMetadata = [NSClassFromString(@"AudioPropertiesReader") propertiesForURL:url skipCue:YES];
|
||||
|
||||
NSString *sheet = [fileMetadata objectForKey:@"cuesheet"];
|
||||
if(!sheet || ![sheet length]) sheet = [alsoMetadata objectForKey:@"cuesheet"];
|
||||
id sheet = [fileMetadata objectForKey:@"cuesheet"];
|
||||
NSString *sheetString = nil;
|
||||
if(sheet) {
|
||||
if([sheet isKindOfClass:[NSArray class]]) {
|
||||
NSArray *sheetContainer = sheet;
|
||||
if([sheetContainer count]) {
|
||||
sheetString = sheetContainer[0];
|
||||
}
|
||||
} else if([sheet isKindOfClass:[NSString class]]) {
|
||||
sheetString = sheet;
|
||||
}
|
||||
}
|
||||
if(!sheetString || ![sheetString length]) {
|
||||
sheet = [alsoMetadata objectForKey:@"cuesheet"];
|
||||
if(sheet) {
|
||||
if([sheet isKindOfClass:[NSArray class]]) {
|
||||
NSArray *sheetContainer = sheet;
|
||||
if([sheetContainer count]) {
|
||||
sheetString = sheetContainer[0];
|
||||
}
|
||||
} else if([sheet isKindOfClass:[NSString class]]) {
|
||||
sheetString = sheet;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if([sheet length]) {
|
||||
cuesheet = [CueSheet cueSheetWithString:sheet withFilename:[url path]];
|
||||
if(sheetString && [sheetString length]) {
|
||||
cuesheet = [CueSheet cueSheetWithString:sheetString withFilename:[url path]];
|
||||
embedded = YES;
|
||||
}
|
||||
} else
|
||||
|
|
Loading…
Reference in New Issue