[M3U Playlist] Reformulate safety checks
Apparently someone managed to crash this with their playlists. No idea how. Added more safety checks. Signed-off-by: Christopher Snowhill <kode54@gmail.com>lastfm
parent
7f1c337ee8
commit
b3e0da6fe9
|
@ -122,14 +122,19 @@
|
|||
for(NSString *entry in [contents componentsSeparatedByString:@"\n"]) {
|
||||
NSString *_entry = [entry stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
|
||||
|
||||
if(_entry == nil || [_entry length] < 1) continue;
|
||||
|
||||
if([_entry hasPrefix:@"#EXT-X-MEDIA-SEQUENCE"]) // Let FFmpeg handle HLS
|
||||
return @[];
|
||||
|
||||
if([_entry hasPrefix:@"#"] || [_entry isEqualToString:@""]) // Ignore extra info
|
||||
if([_entry hasPrefix:@"#"]) // Ignore extra info
|
||||
continue;
|
||||
|
||||
// Need to add basePath, and convert to URL
|
||||
[entries addObject:[self urlForPath:_entry relativeTo:[url path]]];
|
||||
NSURL *fileUrl = [self urlForPath:_entry relativeTo:[url path]];
|
||||
|
||||
if(fileUrl)
|
||||
[entries addObject:fileUrl];
|
||||
}
|
||||
|
||||
return entries;
|
||||
|
|
Loading…
Reference in New Issue