Bug Fix: Really old legacy code error crash fix
This legacy playlist filename handler was falling through on newly installed and run setups, where none of the files would exist, so the last one would return a nil NSURL and attempt to add it to the playlist. Fix this to check for the existence of the file before attempting to open it. It shouldn't really exist anyway, unless someone really started with a really old version somehow, and migrated it to the sandbox folder proper. Signed-off-by: Christopher Snowhill <kode54@gmail.com>
This commit is contained in:
parent
04e40a8370
commit
1d847eb96c
1 changed files with 8 additions and 1 deletions
|
@ -210,8 +210,15 @@ static BOOL consentLastEnabled = NO;
|
||||||
[playlistLoader addDatabase];
|
[playlistLoader addDatabase];
|
||||||
} else if([[NSFileManager defaultManager] fileExistsAtPath:[basePath stringByAppendingPathComponent:newFilename]]) {
|
} else if([[NSFileManager defaultManager] fileExistsAtPath:[basePath stringByAppendingPathComponent:newFilename]]) {
|
||||||
[playlistLoader addURL:[NSURL fileURLWithPath:[basePath stringByAppendingPathComponent:newFilename]]];
|
[playlistLoader addURL:[NSURL fileURLWithPath:[basePath stringByAppendingPathComponent:newFilename]]];
|
||||||
} else {
|
} else if([[NSFileManager defaultManager] fileExistsAtPath:[basePath stringByAppendingPathComponent:oldFilename]]){
|
||||||
|
/* Without the above check, it appears the code was retrieving a nil NSURL from the nonexistent path
|
||||||
|
* Then adding it to the playlist and crashing further down the line
|
||||||
|
* Nobody on a new setup should be seeing this open anything, so it should fall through to the
|
||||||
|
* notice below.
|
||||||
|
*/
|
||||||
[playlistLoader addURL:[NSURL fileURLWithPath:[basePath stringByAppendingPathComponent:oldFilename]]];
|
[playlistLoader addURL:[NSURL fileURLWithPath:[basePath stringByAppendingPathComponent:oldFilename]]];
|
||||||
|
} else {
|
||||||
|
ALog(@"No playlist found, leaving it empty.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue