From b1322640ca55e04ffdf189957dd592e056a92c3b Mon Sep 17 00:00:00 2001 From: Enrico Horn Date: Fri, 16 Jul 2021 19:56:48 +0200 Subject: [PATCH] Always initialize a CallFrame's stack --- luaj-core/src/main/java/org/luaj/vm2/lib/DebugLib.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/luaj-core/src/main/java/org/luaj/vm2/lib/DebugLib.java b/luaj-core/src/main/java/org/luaj/vm2/lib/DebugLib.java index ff921b36..5a2200e5 100644 --- a/luaj-core/src/main/java/org/luaj/vm2/lib/DebugLib.java +++ b/luaj-core/src/main/java/org/luaj/vm2/lib/DebugLib.java @@ -712,11 +712,13 @@ public class DebugLib extends TwoArgFunction { } public static class CallFrame { + static final LuaValue[] EMPTY = {}; + LuaFunction f; int pc; int top; Varargs v; - LuaValue[] stack; + LuaValue[] stack = EMPTY; CallFrame previous; void set(LuaClosure function, Varargs varargs, LuaValue[] stack) { @@ -736,7 +738,7 @@ public class DebugLib extends TwoArgFunction { void reset() { this.f = null; this.v = null; - this.stack = null; + this.stack = EMPTY; } void instr(int pc, Varargs v, int top) {