Skip to content

Commit

Permalink
Add owner check for vehicle light event
Browse files Browse the repository at this point in the history
  • Loading branch information
psiberx committed Nov 25, 2024
1 parent 742c7d3 commit 411702f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/App/Callback/Controllers/VehicleLightControlHook.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ class VehicleLightControlHook

inline static void OnToggleLights(Red::vehicleController* aController, bool aEnable, Red::vehicleELightType aLightType)
{
CallbackSystem::Get()->DispatchNativeEvent<VehicleLightControlEvent>(EventName, Red::AsWeakHandle(aController->owner), aEnable, aLightType);
auto vehicleEntity = Red::AsWeakHandle(aController->owner);
if (vehicleEntity)
{
CallbackSystem::Get()->DispatchNativeEvent<VehicleLightControlEvent>(EventName, vehicleEntity, aEnable, aLightType);
}
}
};
}

0 comments on commit 411702f

Please sign in to comment.