From d93de7ca51edea911eeecb7c8edcffe77298ed07 Mon Sep 17 00:00:00 2001 From: Benoit Germain Date: Mon, 17 Mar 2025 12:23:20 +0100 Subject: Fix crash with LuaJIT when using { name = 'auto' } for lane name detection --- src/lanes.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lanes.cpp b/src/lanes.cpp index b54f221..d1a353b 100644 --- a/src/lanes.cpp +++ b/src/lanes.cpp @@ -363,7 +363,9 @@ LUAG_FUNC(lane_new) if (_debugName == "auto") { if (luaG_type(L, kFuncIdx) == LuaType::STRING) { lua_Debug _ar; - lua_getstack(L, 2, &_ar); // 0 is here, 1 is lanes.gen, 2 is its caller + if (lua_getstack(L, 2, &_ar) == 0) { // 0 is here, 1 is lanes.gen, 2 is its caller + lua_getstack(L, 1, &_ar); // level 2 may not exist with LuaJIT, try again with level 1 + } lua_getinfo(L, "Sl", &_ar); luaG_pushstring(L, "%s:%d", _ar.short_src, _ar.currentline); // L: ... lane "" } else { -- cgit v1.2.3-55-g6feb