fix: errors with out of range arguments

This commit is contained in:
TopchetoEU 2024-12-09 22:16:24 +02:00
parent 28679f44d5
commit 54d55814af
Signed by: topchetoeu
GPG Key ID: 6531B8583E5F6ED4

View File

@ -469,7 +469,9 @@ public class InstructionRunner {
}
private static Value execLoadArg(Environment env, Instruction instr, Frame frame) {
frame.push(frame.args[(int)instr.get(0)]);
int i = instr.get(0);
if (i >= frame.args.length) frame.push(Value.UNDEFINED);
else frame.push(frame.args[i]);
frame.codePtr++;
return null;
}