fix weapon name is nullptr crash bug
This commit is contained in:
@@ -400,13 +400,14 @@ auto luaApi_GivePlayerWeapon(lua_State* luaVm) -> int {
|
|||||||
const auto playerIndex = lua_tointeger(luaVm, 1);
|
const auto playerIndex = lua_tointeger(luaVm, 1);
|
||||||
const auto weaponName = lua_tostring(luaVm, 2);
|
const auto weaponName = lua_tostring(luaVm, 2);
|
||||||
auto isSuccess = false;
|
auto isSuccess = false;
|
||||||
ExcutePlayerAction(playerIndex, [&](CCSPlayerController* playerController) {
|
if (weaponName != nullptr) {
|
||||||
if (playerController->m_bPawnIsAlive() == false) {
|
ExcutePlayerAction(playerIndex, [&](CCSPlayerController* playerController) {
|
||||||
return;
|
if (playerController->m_bPawnIsAlive() == false) {
|
||||||
}
|
return;
|
||||||
isSuccess =
|
}
|
||||||
GameWeapons::ParseWeaponCommand(playerController, weaponName);
|
isSuccess = GameWeapons::ParseWeaponCommand(playerController, weaponName);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
lua_pop(luaVm, 2);
|
lua_pop(luaVm, 2);
|
||||||
lua_pushboolean(luaVm, isSuccess);
|
lua_pushboolean(luaVm, isSuccess);
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user