mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-01 01:53:00 +08:00
[CB-2666] Added check for null arguments.
If null arguments are received, send an error and an explanation.
This commit is contained in:
parent
b42c918973
commit
1fa63300aa
@ -20,6 +20,7 @@ package org.apache.cordova;
|
|||||||
|
|
||||||
import android.webkit.JavascriptInterface;
|
import android.webkit.JavascriptInterface;
|
||||||
import org.apache.cordova.api.PluginManager;
|
import org.apache.cordova.api.PluginManager;
|
||||||
|
import org.apache.cordova.api.PluginResult;
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -39,6 +40,12 @@ import org.json.JSONException;
|
|||||||
|
|
||||||
@JavascriptInterface
|
@JavascriptInterface
|
||||||
public String exec(String service, String action, String callbackId, String arguments) throws JSONException {
|
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);
|
jsMessageQueue.setPaused(true);
|
||||||
try {
|
try {
|
||||||
boolean wasSync = pluginManager.exec(service, action, callbackId, arguments);
|
boolean wasSync = pluginManager.exec(service, action, callbackId, arguments);
|
||||||
|
Loading…
Reference in New Issue
Block a user