You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ia...@apache.org on 2013/05/24 21:23:12 UTC

ios commit: [CB-2840] Nil checks to avoid crash when network disconnected

Updated Branches:
  refs/heads/master f45d4de11 -> 4c63589ac


[CB-2840] Nil checks to avoid crash when network disconnected


Project: http://git-wip-us.apache.org/repos/asf/cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-ios/commit/4c63589a
Tree: http://git-wip-us.apache.org/repos/asf/cordova-ios/tree/4c63589a
Diff: http://git-wip-us.apache.org/repos/asf/cordova-ios/diff/4c63589a

Branch: refs/heads/master
Commit: 4c63589acbc1f37e8aa70c30e1a57560a496af0a
Parents: f45d4de
Author: Ian Clelland <ic...@chromium.org>
Authored: Fri May 24 13:58:27 2013 -0400
Committer: Ian Clelland <ic...@chromium.org>
Committed: Fri May 24 13:58:27 2013 -0400

----------------------------------------------------------------------
 CordovaLib/Classes/CDVFileTransfer.m |   20 +++++++++++++++-----
 iphone/beep.wav                      |  Bin 0 -> 8114 bytes
 2 files changed, 15 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/4c63589a/CordovaLib/Classes/CDVFileTransfer.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVFileTransfer.m b/CordovaLib/Classes/CDVFileTransfer.m
index 5536715..8391b3b 100644
--- a/CordovaLib/Classes/CDVFileTransfer.m
+++ b/CordovaLib/Classes/CDVFileTransfer.m
@@ -429,8 +429,12 @@ static CFIndex WriteDataToStream(NSData* data, CFWriteStreamRef stream)
     NSMutableDictionary* result = [NSMutableDictionary dictionaryWithCapacity:3];
 
     [result setObject:[NSNumber numberWithInt:code] forKey:@"code"];
-    [result setObject:source forKey:@"source"];
-    [result setObject:target forKey:@"target"];
+    if (source != nil) {
+        [result setObject:source forKey:@"source"];
+    }
+    if (target != nil) {
+        [result setObject:target forKey:@"target"];
+    }
     NSLog(@"FileTransferError %@", result);
 
     return result;
@@ -445,10 +449,16 @@ static CFIndex WriteDataToStream(NSData* data, CFWriteStreamRef stream)
     NSMutableDictionary* result = [NSMutableDictionary dictionaryWithCapacity:5];
 
     [result setObject:[NSNumber numberWithInt:code] forKey:@"code"];
-    [result setObject:source forKey:@"source"];
-    [result setObject:target forKey:@"target"];
+    if (source != nil) {
+        [result setObject:source forKey:@"source"];
+    }
+    if (target != nil) {
+        [result setObject:target forKey:@"target"];
+    }
     [result setObject:[NSNumber numberWithInt:httpStatus] forKey:@"http_status"];
-    [result setObject:body forKey:@"body"];
+    if (body != nil) {
+        [result setObject:body forKey:@"body"];
+    }
     NSLog(@"FileTransferError %@", result);
 
     return result;

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/4c63589a/iphone/beep.wav
----------------------------------------------------------------------
diff --git a/iphone/beep.wav b/iphone/beep.wav
new file mode 100644
index 0000000..05f5997
Binary files /dev/null and b/iphone/beep.wav differ