Skip to content

Commit 6c6a362

Browse files
fix(citizen-script-lua): Fix crash with nil value as name in CreateThreadNow
1 parent c95b323 commit 6c6a362

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

code/components/citizen-scripting-lua/src/LuaScriptRuntime.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -1139,7 +1139,11 @@ static int Lua_CreateThreadNow(lua_State* L)
11391139

11401140
if (lua_gettop(L) >= 2)
11411141
{
1142-
name = lua_tostring(L, 2);
1142+
auto luaName = lua_tostring(L, 2);
1143+
if (luaName != nullptr)
1144+
{
1145+
name = luaName;
1146+
}
11431147
}
11441148

11451149
return Lua_CreateThreadInternal(L, true, 0, 1, name);

0 commit comments

Comments
 (0)