cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject [03/36] ios commit: [CB-2840] Nil checks to avoid crash when network disconnected
Date Tue, 11 Jun 2013 00:51:17 GMT
[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/3.0.0
Commit: 4c63589acbc1f37e8aa70c30e1a57560a496af0a
Parents: f45d4de
Author: Ian Clelland <iclelland@chromium.org>
Authored: Fri May 24 13:58:27 2013 -0400
Committer: Ian Clelland <iclelland@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


Mime
View raw message