Check instanceReceiver before call

This commit is contained in:
Him188 2020-10-30 09:48:32 +08:00
parent 3b14d70cc5
commit 77e38dd964

View File

@ -254,6 +254,10 @@ internal class CommandReflector(
val instanceParameter = function.instanceParameter val instanceParameter = function.instanceParameter
if (instanceParameter != null) { if (instanceParameter != null) {
check(instanceParameter.type.classifierAsKClass().isInstance(command)) {
"Bad command call resolved. " +
"Function expects instance parameter ${instanceParameter.type} whereas actual instance is ${command::class}."
}
args[instanceParameter] = command args[instanceParameter] = command
} }