TriggerReactor

TriggerReactor

24.6k Downloads

LambdaFunction may cause NPE.

son-daehyeon opened this issue · 2 comments

commented

https://github.com/TriggerReactor/TriggerReactor/blob/master/core/src/main/java/io/github/wysohn/triggerreactor/core/script/interpreter/lambda/LambdaFunction.java#L36-L37

@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
    int argsLength = args == null ? 0 : args.length;
    
    if(parameters.length != argsLength)
        throw new InterpreterException("Number of Lambda parameters doesn't match. Caller provided "+args.length+"" +
                " arguments, yet the LAMBDA only has "+parameters.length+" ids. "+body);

    // initialize arguments as variables in the lambda
    for (int i = 0; i < parameters.length; i++) {
        lambdaBody.getVars().put(parameters[i].id, args[i]);
    }

    lambdaBody.start();

    return lambdaBody.result();
}

6번째 줄에서 Caller provided + args.length + arguments 부분에서 args는 null일 수도 있습니다.

commented

fix in #547

commented

Fixed in #549, first was released on v3.3.6