Commit 0cd7e54f authored by Marvin Scholz's avatar Marvin Scholz Committed by David
Browse files

macosx: VLCPlaylistDataSource: fix error handling

The previous check if data is nil is useless here, as
unarchiveObjectWithData can not modify data, and there is
already a check above this code that ensures data is not nil.
But unarchiveObjectWithData could fail if it can not decode the
archive, raising an NSInvalidArgumentException, so handle that
properly.
parent 29f72ea1
......@@ -161,10 +161,18 @@ static NSString *VLCPlaylistCellIdentifier = @"VLCPlaylistCellIdentifier";
}
/* it is a media library item, so unarchive it and add it to the playlist */
NSArray *array = [NSKeyedUnarchiver unarchiveObjectWithData:data];
if (!data) {
return NO;
NSArray *array = nil;
@try {
array = [NSKeyedUnarchiver unarchiveObjectWithData:data];
} @catch (NSException *exception) {
if ([exception.name isEqualToString:NSInvalidArgumentException]) {
msg_Err(getIntf(), "Failed to unarchive MediaLibrary Item: %s",
[[exception reason] UTF8String]);
return NO;
}
@throw;
}
NSUInteger arrayCount = array.count;
for (NSUInteger x = 0; x < arrayCount; x++) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment