From d4c21bc204e61a36199b3a67efaf70b7f0ddf2e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eduardo=20Fraz=C3=A3o?= Date: Wed, 13 Mar 2024 10:56:41 -0300 Subject: [PATCH] NPE fix when a non-argument JavaScript method is collected and exposed as a JavaProxy calling "getInterface" of RhinoScriptEngine --- src/org/mozilla/javascript/engine/RhinoScriptEngine.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/org/mozilla/javascript/engine/RhinoScriptEngine.java b/src/org/mozilla/javascript/engine/RhinoScriptEngine.java index d49dd44e9b..977499b456 100644 --- a/src/org/mozilla/javascript/engine/RhinoScriptEngine.java +++ b/src/org/mozilla/javascript/engine/RhinoScriptEngine.java @@ -23,6 +23,7 @@ import org.mozilla.javascript.ContextFactory; import org.mozilla.javascript.RhinoException; import org.mozilla.javascript.Script; +import org.mozilla.javascript.ScriptRuntime; import org.mozilla.javascript.Scriptable; import org.mozilla.javascript.ScriptableObject; @@ -201,6 +202,8 @@ Object invokeMethodRaw(Object thiz, String name, Class returnType, Object... for (int i = 0; i < args.length; i++) { args[i] = Context.javaToJS(args[i], scope); } + } else { + args = ScriptRuntime.emptyArgs; } Object ret = func.call(cx, scope, localThis, args);