mirror of
https://github.com/enso-org/enso.git
synced 2024-12-23 13:02:07 +03:00
Avoid ArrayIndexOutOfBoundsException with no args (#9393)
The `null` check creates a new Array but always assumed a non-empty one which may lead to ``` java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0 at org.enso.runtime/org.enso.interpreter.service.ExecutionService$FunctionPointer.collectNotAppliedArguments(ExecutionService.java:778) at org.enso.runtime/org.enso.interpreter.instrument.job.ProgramExecutionSupport$.sendExpressionUpdate(ProgramExecutionSupport.scala:430) at org.enso.runtime/org.enso.interpreter.instrument.job.ProgramExecutionSupport$.$anonfun$executeProgram$3(ProgramExecutionSupport.scala:81) at org.enso.runtime/org.enso.interpreter.service.ExecutionCallbacks.callOnComputedCallback(ExecutionCallbacks.java:146) at org.enso.runtime/org.enso.interpreter.service.ExecutionCallbacks.updateCachedResult(ExecutionCallbacks.java:117 ... ``` Added a guard to prevent the exception. The flag will be useless anyway as we won't enter the for-loop in this case. Appears to be introduced via #8743. Discovered while debugging #9389.
This commit is contained in:
parent
8d9c25cdda
commit
3755f90fef
@ -775,7 +775,7 @@ public final class ExecutionService {
|
||||
if (preAppliedArguments == null) {
|
||||
preAppliedArguments = new Object[functionSchema.getArgumentsCount()];
|
||||
}
|
||||
boolean isStatic = preAppliedArguments[0] instanceof Type;
|
||||
boolean isStatic = preAppliedArguments.length == 0 || preAppliedArguments[0] instanceof Type;
|
||||
int selfArgumentPosition = isStatic ? -1 : 0;
|
||||
int[] notAppliedArguments = new int[functionSchema.getArgumentsCount()];
|
||||
int notAppliedArgumentsLength = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user