Guard against the receipt of empty paths
This commit is contained in:
@@ -190,6 +190,22 @@ NSString *const SSZipArchiveErrorDomain = @"SSZipArchiveErrorDomain";
|
||||
progressHandler:(void (^)(NSString *entry, unz_file_info zipInfo, long entryNumber, long total))progressHandler
|
||||
completionHandler:(void (^)(NSString *path, BOOL succeeded, NSError * __nullable error))completionHandler
|
||||
{
|
||||
|
||||
// Guard against empty strings
|
||||
if ([path length] == 0 || [destination length] == 0)
|
||||
{
|
||||
NSDictionary *userInfo = @{NSLocalizedDescriptionKey: @"received invalid argument(s)"};
|
||||
NSError *err = [NSError errorWithDomain:SSZipArchiveErrorDomain code:SSZipArchiveErrorCodeInvalidArguments userInfo:userInfo];
|
||||
if (error)
|
||||
{
|
||||
*error = err;
|
||||
}
|
||||
if (completionHandler)
|
||||
{
|
||||
completionHandler(nil, NO, err);
|
||||
}
|
||||
}
|
||||
|
||||
// Begin opening
|
||||
zipFile zip = unzOpen((const char*)[path fileSystemRepresentation]);
|
||||
if (zip == NULL)
|
||||
|
||||
Reference in New Issue
Block a user