Skip to content

Commit

Permalink
Fix getAccountType crash - #3019 (#3453)
Browse files Browse the repository at this point in the history
  • Loading branch information
TracerDS authored Jun 9, 2024
1 parent d93287d commit 0802e74
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions Server/mods/deathmatch/logic/luadefs/CLuaAccountDefs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ int CLuaAccountDefs::GetAccountName(lua_State* luaVM)
return 1;
}

std::optional<std::string> CLuaAccountDefs::GetAccountType(CAccount* pAccount)
std::string CLuaAccountDefs::GetAccountType(CAccount* pAccount)
{
switch (pAccount->GetType())
{
Expand All @@ -128,8 +128,9 @@ std::optional<std::string> CLuaAccountDefs::GetAccountType(CAccount* pAccount)
return "console";
case EAccountType::Player:
return "player";
default:
return "unknown";
}
return {};
}

int CLuaAccountDefs::GetAccountPlayer(lua_State* luaVM)
Expand Down
2 changes: 1 addition & 1 deletion Server/mods/deathmatch/logic/luadefs/CLuaAccountDefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class CLuaAccountDefs : public CLuaDefs
LUA_DECLARE(GetAccounts);
LUA_DECLARE(GetAccountName);

static std::optional<std::string> GetAccountType(CAccount* pAccount);
static std::string GetAccountType(CAccount* pAccount);

LUA_DECLARE(GetAccountPlayer);
LUA_DECLARE(IsGuestAccount);
Expand Down

0 comments on commit 0802e74

Please sign in to comment.