returning write errors and preventing multiple calls to close by setting _zip to nil

This commit is contained in:
Antoine Cœur
2017-09-10 03:07:15 +08:00
parent 44329ab1a1
commit f3030e34ab
+3 -2
View File
@@ -859,8 +859,9 @@ NSString *const SSZipArchiveErrorDomain = @"SSZipArchiveErrorDomain";
- (BOOL)close
{
NSAssert((_zip != NULL), @"[SSZipArchive] Attempting to close an archive which was never opened");
zipClose(_zip, NULL);
return YES;
int error = zipClose(_zip, NULL);
_zip = nil;
return error == UNZ_OK;
}
#pragma mark - Private