incubator-callback-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agri...@apache.org
Subject js commit: Fix Camera.getPicture when options are not passed.
Date Thu, 27 Sep 2012 17:51:23 GMT
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 <agrieve@chromium.org>
Authored: Thu Sep 27 13:50:49 2012 -0400
Committer: Andrew Grieve <agrieve@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();


Mime
View raw message