Added g_local_player pointer sanity checks. (#2792)

This commit is contained in:
gir489
2024-03-01 11:48:20 -05:00
committed by GitHub
parent 903c5273ed
commit f4e0da5ff4
5 changed files with 16 additions and 7 deletions

View File

@ -7,6 +7,9 @@ namespace big
{
void looped::vehicle_boost_behavior()
{
if (g_local_player == nullptr)
return;
auto* const vehicle = g_local_player->m_vehicle;
bool is_rocket = VEHICLE::GET_HAS_ROCKET_BOOST(self::veh);

View File

@ -15,7 +15,7 @@ namespace big
virtual void on_tick() override
{
if (!self::veh || !g_local_player->m_vehicle || HUD::IS_PAUSE_MENU_ACTIVE() || HUD::IS_WARNING_MESSAGE_ACTIVE() || CAM::IS_SCREEN_FADED_OUT() || CAM::IS_SCREEN_FADING_OUT() || CAM::IS_SCREEN_FADING_IN())
if (!self::veh || !g_local_player || !g_local_player->m_vehicle || HUD::IS_PAUSE_MENU_ACTIVE() || HUD::IS_WARNING_MESSAGE_ACTIVE() || CAM::IS_SCREEN_FADED_OUT() || CAM::IS_SCREEN_FADING_OUT() || CAM::IS_SCREEN_FADING_IN())
{
return;
}

View File

@ -108,11 +108,14 @@ namespace big
virtual void on_enable() override
{
reset(g_local_player->m_vehicle);
if (g_local_player)
reset(g_local_player->m_vehicle);
}
virtual void on_tick() override
{
if (g_local_player == nullptr)
return;
const auto curr_veh = g_local_player->m_vehicle;
if (curr_veh && !(g_local_player->m_ped_task_flag & (int)ePedTask::TASK_DRIVING))
{