diff options
| author | Benoit Germain <benoit.germain@ubisoft.com> | 2025-03-14 14:49:22 +0100 |
|---|---|---|
| committer | Benoit Germain <benoit.germain@ubisoft.com> | 2025-03-14 14:49:22 +0100 |
| commit | 0aa030db022c57947afbae3b97038a403973e3cd (patch) | |
| tree | c035221e9656222f9d1b2c9af2177c24a9ab3baf /src | |
| parent | dee0756ff21c1f7dd4eea067dfb90feb1ba4763d (diff) | |
| download | lanes-0aa030db022c57947afbae3b97038a403973e3cd.tar.gz lanes-0aa030db022c57947afbae3b97038a403973e3cd.tar.bz2 lanes-0aa030db022c57947afbae3b97038a403973e3cd.zip | |
Fix crash when using { name = 'auto' } with a lane generated from a string
Diffstat (limited to 'src')
| -rw-r--r-- | src/lanes.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/lanes.cpp b/src/lanes.cpp index 15e04a3..b54f221 100644 --- a/src/lanes.cpp +++ b/src/lanes.cpp | |||
| @@ -361,10 +361,17 @@ LUAG_FUNC(lane_new) | |||
| 361 | if (!_debugName.empty()) | 361 | if (!_debugName.empty()) |
| 362 | { | 362 | { |
| 363 | if (_debugName == "auto") { | 363 | if (_debugName == "auto") { |
| 364 | lua_Debug _ar; | 364 | if (luaG_type(L, kFuncIdx) == LuaType::STRING) { |
| 365 | lua_pushvalue(L, kFuncIdx); // L: ... lane func | 365 | lua_Debug _ar; |
| 366 | lua_getinfo(L, ">S", &_ar); // L: ... lane | 366 | lua_getstack(L, 2, &_ar); // 0 is here, 1 is lanes.gen, 2 is its caller |
| 367 | luaG_pushstring(L, "%s:%d", _ar.short_src, _ar.linedefined); // L: ... lane "<name>" | 367 | lua_getinfo(L, "Sl", &_ar); |
| 368 | luaG_pushstring(L, "%s:%d", _ar.short_src, _ar.currentline); // L: ... lane "<name>" | ||
| 369 | } else { | ||
| 370 | lua_Debug _ar; | ||
| 371 | lua_pushvalue(L, kFuncIdx); // L: ... lane func | ||
| 372 | lua_getinfo(L, ">S", &_ar); // L: ... lane | ||
| 373 | luaG_pushstring(L, "%s:%d", _ar.short_src, _ar.linedefined); // L: ... lane "<name>" | ||
| 374 | } | ||
| 368 | lua_replace(L, _name_idx); // L: ... lane | 375 | lua_replace(L, _name_idx); // L: ... lane |
| 369 | _debugName = luaG_tostring(L, _name_idx); | 376 | _debugName = luaG_tostring(L, _name_idx); |
| 370 | } | 377 | } |
