Updated Branches:
  refs/heads/master 1c9ce2a03 -> 5c5297504

[CB-1479] Cordova 2.1 Capture Problem if no options provided


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/5c529750
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/tree/5c529750
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/diff/5c529750

Branch: refs/heads/master
Commit: 5c5297504b899459c50e21e8420922b84f58dea0
Parents: 1c9ce2a
Author: Shazron Abdullah <shaz...@apache.org>
Authored: Wed Sep 19 17:13:43 2012 -0700
Committer: Shazron Abdullah <shaz...@apache.org>
Committed: Wed Sep 19 17:13:43 2012 -0700

----------------------------------------------------------------------
 CordovaLib/Classes/CDVCapture.m |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/5c529750/CordovaLib/Classes/CDVCapture.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVCapture.m b/CordovaLib/Classes/CDVCapture.m
index 7a57219..0466f12 100644
--- a/CordovaLib/Classes/CDVCapture.m
+++ b/CordovaLib/Classes/CDVCapture.m
@@ -64,6 +64,10 @@
 {
     NSString* callbackId = command.callbackId;
     NSDictionary* options = [command.arguments objectAtIndex:0];
+    if ([options isKindOfClass:[NSNull class]]) {
+        options = [NSDictionary dictionary];
+    }
+    
     NSNumber* duration = [options objectForKey:@"duration"];
     // the default value of duration is 0 so use nil (no duration) if default 
value
     if (duration) {
@@ -100,6 +104,9 @@
 {
     NSString* callbackId = command.callbackId;
     NSDictionary* options = [command.arguments objectAtIndex:0];
+    if ([options isKindOfClass:[NSNull class]]) {
+        options = [NSDictionary dictionary];
+    }
     NSString* mode = [options objectForKey:@"mode"];
     
        //options could contain limit and mode neither of which are supported 
at this time
@@ -199,6 +206,11 @@
 - (void) captureVideo:(CDVInvokedUrlCommand*)command
 {
     NSString* callbackId = command.callbackId;
+    NSDictionary* options = [command.arguments objectAtIndex:0];
+    if ([options isKindOfClass:[NSNull class]]) {
+        options = [NSDictionary dictionary];
+    }
+    
        //options could contain limit, duration and mode, only duration is 
supported (but is not due to apple bug)
     // taking more than one video (limit) is only supported if provide own 
controls via cameraOverlayView property
     //NSNumber* duration = [options objectForKey:@"duration"];

Reply via email to