From 1fa63300aa9783e4664d43c745df7b9013653602 Mon Sep 17 00:00:00 2001 From: Max Woghiren Date: Wed, 27 Mar 2013 12:09:17 -0400 Subject: [PATCH] [CB-2666] Added check for null arguments. If null arguments are received, send an error and an explanation. --- framework/src/org/apache/cordova/ExposedJsApi.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/framework/src/org/apache/cordova/ExposedJsApi.java b/framework/src/org/apache/cordova/ExposedJsApi.java index 48e71021..7702d350 100755 --- a/framework/src/org/apache/cordova/ExposedJsApi.java +++ b/framework/src/org/apache/cordova/ExposedJsApi.java @@ -20,6 +20,7 @@ package org.apache.cordova; import android.webkit.JavascriptInterface; import org.apache.cordova.api.PluginManager; +import org.apache.cordova.api.PluginResult; import org.json.JSONException; /** @@ -39,6 +40,12 @@ import org.json.JSONException; @JavascriptInterface public String exec(String service, String action, String callbackId, String arguments) throws JSONException { + // If the arguments weren't received, send a message back to JS. It will switch bridge modes and try again. See CB-2666. + // We send a message meant specifically for this case. It starts with "@" so no other message can be encoded into the same string. + if (arguments == null) { + return "@Null arguments."; + } + jsMessageQueue.setPaused(true); try { boolean wasSync = pluginManager.exec(service, action, callbackId, arguments);