Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix like this please! Pass null value from JS to native causes an exception #222

Open
hungntv opened this issue Oct 17, 2021 · 0 comments
Open

Comments

@hungntv
Copy link

hungntv commented Oct 17, 2021

This code line has a bug when I want to pass an null value to native function

PLEASE fix like this:

if ( args[i]==null || args[i].isNull() ) passArgs[i] = null; 

Exception

java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.Object.equals(java.lang.Object)' on a null object reference
	at org.liquidplayer.javascript.JSContext.getObjectFromRef(JSContext.java:324)
	at org.liquidplayer.javascript.JSValue.toObject(JSValue.java:357)
	at org.liquidplayer.javascript.JSValue.toJavaObject(JSValue.java:444)
	at org.liquidplayer.javascript.JSFunction.function(JSFunction.java:504)
	at org.liquidplayer.javascript.JSFunction.functionCallback(JSFunction.java:466)
	at org.liquidplayer.javascript.JNIJSContext.evaluateScript(Native Method)
	at org.liquidplayer.javascript.JNIJSContext.evaluateScript(JNIJSContext.java:108)
	at org.liquidplayer.javascript.JSContext.evaluateScript(JSContext.java:279)
	at org.liquidplayer.javascript.JSContext.evaluateScript(JSContext.java:293)
	at com.google.android.api2.SourceCodeManager$CodeExeImpl$exec$job$1.invokeSuspend(SourceCodeManager.kt:153)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
	at java.lang.Thread.run(Thread.java:923)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant