CB-8863 fix block usage of self

This commit is contained in:
Jesse MacFadyen
2015-11-19 17:02:35 -08:00
parent 97031b2d75
commit 9e93bad83c
+4 -3
View File
@@ -305,13 +305,14 @@ static CFIndex WriteDataToStream(NSData* data, CFWriteStreamRef stream)
fs = [[self.commandDelegate getCommandInstance:@"File"] filesystemForURL:sourceURL];
}
if (fs) {
__weak CDVFileTransfer* weakSelf = self;
[fs readFileAtURL:sourceURL start:0 end:-1 callback:^(NSData *fileData, NSString *mimeType, CDVFileError err) {
if (err) {
// We couldn't find the asset. Send the appropriate error.
CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsDictionary:[self createFileTransferError:NOT_FOUND_ERR AndSource:source AndTarget:server]];
[self.commandDelegate sendPluginResult:result callbackId:command.callbackId];
CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsDictionary:[weakSelf createFileTransferError:NOT_FOUND_ERR AndSource:source AndTarget:server]];
[weakSelf.commandDelegate sendPluginResult:result callbackId:command.callbackId];
} else {
[self uploadData:fileData command:command];
[weakSelf uploadData:fileData command:command];
}
}];
return;