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/27 19:51:23 UTC

js commit: Fix Camera.getPicture when options are not passed.

Updated Branches:
  refs/heads/master 620cb2813 -> 968764b2f


Fix Camera.getPicture when options are not passed.


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/commit/968764b2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/tree/968764b2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/diff/968764b2

Branch: refs/heads/master
Commit: 968764b2f67ff2ed755eace083b83f395cf0e9c2
Parents: 620cb28
Author: Andrew Grieve <ag...@chromium.org>
Authored: Thu Sep 27 13:50:49 2012 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Thu Sep 27 13:50:49 2012 -0400

----------------------------------------------------------------------
 lib/common/plugin/Camera.js |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/968764b2/lib/common/plugin/Camera.js
----------------------------------------------------------------------
diff --git a/lib/common/plugin/Camera.js b/lib/common/plugin/Camera.js
index 6388723..e4a1efa 100644
--- a/lib/common/plugin/Camera.js
+++ b/lib/common/plugin/Camera.js
@@ -40,6 +40,7 @@ for (var key in Camera) {
  * @param {Object} options
  */
 cameraExport.getPicture = function(successCallback, errorCallback, options) {
+    options = options || {};
     // successCallback required
     if (typeof successCallback != "function") {
         console.log("Camera Error: successCallback is not a function");
@@ -53,9 +54,9 @@ cameraExport.getPicture = function(successCallback, errorCallback, options) {
     }
 
     var quality = 50;
-    if (options && typeof options.quality == "number") {
+    if (typeof options.quality == "number") {
         quality = options.quality;
-    } else if (options && typeof options.quality == "string") {
+    } else if (typeof options.quality == "string") {
         var qlity = parseInt(options.quality, 10);
         if (isNaN(qlity) === false) {
             quality = qlity.valueOf();