From f838db4e181d658fda69e4f962436ab5fbf8d9c4 Mon Sep 17 00:00:00 2001 From: Thomas Raffray Date: Wed, 21 Sep 2016 11:06:01 +0200 Subject: [PATCH] CB-11880 android: Fail-safe for cordova.exec() - added preliminary sanity check on args variable - replication of iosExec() behaviour - allows to call cordova.exec() without args variable This closes #334 --- cordova-js-src/exec.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cordova-js-src/exec.js b/cordova-js-src/exec.js index b45aee86..f73d87a1 100644 --- a/cordova-js-src/exec.js +++ b/cordova-js-src/exec.js @@ -78,6 +78,9 @@ function androidExec(success, fail, service, action, args) { androidExec.setJsToNativeBridgeMode(jsToNativeModes.JS_OBJECT); } + // If args is not provided, default to an empty array + args = args || []; + // Process any ArrayBuffers in the args into a string. for (var i = 0; i < args.length; i++) { if (utils.typeName(args[i]) == 'ArrayBuffer') {