diff --git a/src/backend/looped/vehicle/boost_behavior.cpp b/src/backend/looped/vehicle/boost_behavior.cpp index 50f5bfcf..67eec184 100644 --- a/src/backend/looped/vehicle/boost_behavior.cpp +++ b/src/backend/looped/vehicle/boost_behavior.cpp @@ -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); diff --git a/src/backend/looped/vehicle/speedo_meter.cpp b/src/backend/looped/vehicle/speedo_meter.cpp index 3a079787..826283bc 100644 --- a/src/backend/looped/vehicle/speedo_meter.cpp +++ b/src/backend/looped/vehicle/speedo_meter.cpp @@ -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; } diff --git a/src/backend/looped/vehicle/vehicle_abilities.cpp b/src/backend/looped/vehicle/vehicle_abilities.cpp index ed1a41b0..60cde83b 100644 --- a/src/backend/looped/vehicle/vehicle_abilities.cpp +++ b/src/backend/looped/vehicle/vehicle_abilities.cpp @@ -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)) { diff --git a/src/views/world/view_blackhole.cpp b/src/views/world/view_blackhole.cpp index 6c694e5c..6f6b23d0 100644 --- a/src/views/world/view_blackhole.cpp +++ b/src/views/world/view_blackhole.cpp @@ -18,11 +18,14 @@ namespace big ImGui::SliderFloat("VIEW_BLACKHOLE_SCALE"_T.data(), &g.world.blackhole.scale, 2.f, 12.f, "%.0f"); components::button("VIEW_BLACKHOLE_SET"_T, [] { - const auto player_pos = g_local_player->get_position(); + if (g_local_player) + { + const auto player_pos = g_local_player->get_position(); - g.world.blackhole.pos.x = player_pos->x; - g.world.blackhole.pos.y = player_pos->y; - g.world.blackhole.pos.z = player_pos->z; + g.world.blackhole.pos.x = player_pos->x; + g.world.blackhole.pos.y = player_pos->y; + g.world.blackhole.pos.z = player_pos->z; + } }); ImGui::SeparatorText("VIEW_BLACKHOLE_CUSTOM"_T.data());