Don't crash if there is no HandleCheats function in lua.
This commit is contained in:
parent
4be2abce6a
commit
646d96b58a
2 changed files with 5 additions and 1 deletions
src
|
@ -976,7 +976,7 @@ global int main(int argc, char** argv)
|
|||
#ifdef USE_WIN32
|
||||
strcpy(LocalPlayerName, "Anonymous");
|
||||
#else
|
||||
if (getenv("USERNAME")) {
|
||||
if (getenv("USER")) {
|
||||
strncpy(LocalPlayerName, getenv("USERNAME"), 14);
|
||||
} else {
|
||||
strcpy(LocalPlayerName, "Anonymous");
|
||||
|
|
|
@ -996,6 +996,10 @@ global int HandleCheats(const char* input)
|
|||
#endif
|
||||
lua_pushstring(Lua, "HandleCheats");
|
||||
lua_gettable(Lua, LUA_GLOBALSINDEX);
|
||||
if (!lua_isfunction(Lua, -1)) {
|
||||
DebugLevel0Fn("No HandleCheats function in lua.\n");
|
||||
return 0;
|
||||
}
|
||||
lua_pushstring(Lua, input);
|
||||
LuaCall(1, 0);
|
||||
ret = lua_gettop(Lua);
|
||||
|
|
Loading…
Add table
Reference in a new issue