aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenoit Germain <benoit.germain@ubisoft.com>2025-03-17 12:23:20 +0100
committerBenoit Germain <benoit.germain@ubisoft.com>2025-03-17 12:23:20 +0100
commitd93de7ca51edea911eeecb7c8edcffe77298ed07 (patch)
tree101556591a32c047098e5b3e727dc6fa82d54a14
parent512f4c0b46ea5cc359e673b7379cd81925863121 (diff)
downloadlanes-d93de7ca51edea911eeecb7c8edcffe77298ed07.tar.gz
lanes-d93de7ca51edea911eeecb7c8edcffe77298ed07.tar.bz2
lanes-d93de7ca51edea911eeecb7c8edcffe77298ed07.zip
Fix crash with LuaJIT when using { name = 'auto' } for lane name detection
-rw-r--r--src/lanes.cpp4
1 files changed, 3 insertions, 1 deletions
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)
363 if (_debugName == "auto") { 363 if (_debugName == "auto") {
364 if (luaG_type(L, kFuncIdx) == LuaType::STRING) { 364 if (luaG_type(L, kFuncIdx) == LuaType::STRING) {
365 lua_Debug _ar; 365 lua_Debug _ar;
366 lua_getstack(L, 2, &_ar); // 0 is here, 1 is lanes.gen, 2 is its caller 366 if (lua_getstack(L, 2, &_ar) == 0) { // 0 is here, 1 is lanes.gen, 2 is its caller
367 lua_getstack(L, 1, &_ar); // level 2 may not exist with LuaJIT, try again with level 1
368 }
367 lua_getinfo(L, "Sl", &_ar); 369 lua_getinfo(L, "Sl", &_ar);
368 luaG_pushstring(L, "%s:%d", _ar.short_src, _ar.currentline); // L: ... lane "<name>" 370 luaG_pushstring(L, "%s:%d", _ar.short_src, _ar.currentline); // L: ... lane "<name>"
369 } else { 371 } else {