Android: Fix NPE when proxy interface method has no arguments
JDK contract: InvocationHandler.invoke's args parameter is null when the proxied interface method takes no arguments. The proxy handlers in AndroidRuntimePlugin used `*args` directly, which spread-deref'd null and threw NullPointerException. Signed-off-by: Muteem <29696635+Muteem@users.noreply.github.com>
This commit is contained in:
+2
-2
@@ -86,7 +86,7 @@ class AndroidRuntimePlugin(godot: Godot) : GodotPlugin(godot) {
|
||||
|
||||
// Invocation for the interface single abstract method falls here and is dispatched to the
|
||||
// Godot [Callable].
|
||||
else -> godotCallable.call(*args)
|
||||
else -> godotCallable.call(*(args ?: emptyArray()))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -111,7 +111,7 @@ class AndroidRuntimePlugin(godot: Godot) : GodotPlugin(godot) {
|
||||
|
||||
// Invocation for the remaining interface(s) methods falls here and is dispatched to the
|
||||
// Godot Object.
|
||||
else -> Callable.call(godotObjectID, methodName, *args)
|
||||
else -> Callable.call(godotObjectID, methodName, *(args ?: emptyArray()))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user