You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ag...@apache.org on 2012/09/05 20:48:13 UTC
ios commit: Fix null dereference in file upload when URL is invalid.
Updated Branches:
refs/heads/master f90626c67 -> e1781b030
Fix null dereference in file upload when URL is invalid.
Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/commit/e1781b03
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/tree/e1781b03
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/diff/e1781b03
Branch: refs/heads/master
Commit: e1781b0302ff51cb65581f08b783a420f6371ede
Parents: f90626c
Author: Andrew Grieve <ag...@chromium.org>
Authored: Wed Sep 5 14:46:31 2012 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Wed Sep 5 14:47:29 2012 -0400
----------------------------------------------------------------------
CordovaLib/Classes/CDVFileTransfer.m | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/e1781b03/CordovaLib/Classes/CDVFileTransfer.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVFileTransfer.m b/CordovaLib/Classes/CDVFileTransfer.m
index d0cb145..3115f34 100644
--- a/CordovaLib/Classes/CDVFileTransfer.m
+++ b/CordovaLib/Classes/CDVFileTransfer.m
@@ -267,8 +267,10 @@ static CFIndex WriteDataToStream(NSData* data, CFWriteStreamRef stream) {
// fileData and req are split into helper functions to ease the unit testing of delegateForUpload.
NSData* fileData = [self fileDataForUploadCommand:command];
NSURLRequest* req = [self requestForUploadCommand:command fileData:fileData];
- CDVFileTransferDelegate* delegate = [self delegateForUploadCommand:command];
- [NSURLConnection connectionWithRequest:req delegate:delegate];
+ if (req != nil) {
+ CDVFileTransferDelegate* delegate = [self delegateForUploadCommand:command];
+ [NSURLConnection connectionWithRequest:req delegate:delegate];
+ }
}
- (void) download:(CDVInvokedUrlCommand*)command {