handle null args array in proxy invocation handler
Reviewed By: astreet Differential Revision: D3212837 fb-gh-sync-id: 1a66de68cc13758a41514e4bef6808b818b9682e fbshipit-source-id: 1a66de68cc13758a41514e4bef6808b818b9682e
This commit is contained in:
parent
131970dc5a
commit
fb76154b42
|
@ -11,7 +11,6 @@ package com.facebook.react.bridge;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import java.lang.Class;
|
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
import java.lang.reflect.InvocationHandler;
|
import java.lang.reflect.InvocationHandler;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
@ -87,19 +86,20 @@ public class JavaScriptModuleRegistry {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @Nullable Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
|
public @Nullable Object invoke(Object proxy, Method method, @Nullable Object[] args) throws Throwable {
|
||||||
ExecutorToken executorToken = mExecutorToken.get();
|
ExecutorToken executorToken = mExecutorToken.get();
|
||||||
if (executorToken == null) {
|
if (executorToken == null) {
|
||||||
FLog.w(ReactConstants.TAG, "Dropping JS call, ExecutorToken went away...");
|
FLog.w(ReactConstants.TAG, "Dropping JS call, ExecutorToken went away...");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
String tracingName = mModuleRegistration.getTracingName(method);
|
String tracingName = mModuleRegistration.getTracingName(method);
|
||||||
|
NativeArray jsArgs = args != null ? Arguments.fromJavaArgs(args) : new WritableNativeArray();
|
||||||
mCatalystInstance.callFunction(
|
mCatalystInstance.callFunction(
|
||||||
executorToken,
|
executorToken,
|
||||||
mModuleRegistration.getModuleId(),
|
mModuleRegistration.getModuleId(),
|
||||||
mModuleRegistration.getMethodId(method),
|
mModuleRegistration.getMethodId(method),
|
||||||
Arguments.fromJavaArgs(args),
|
jsArgs,
|
||||||
tracingName);
|
tracingName);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue