1
Fork 0
mirror of https://github.com/thegeneralist01/Scene-Manager-DevRepo synced 2026-01-10 15:20:29 +01:00

Fixed crash when directing driver to a path

This commit is contained in:
Rich Dunne 2021-07-24 07:35:47 -06:00
parent c68ba728e9
commit d118513185

View file

@ -52,7 +52,7 @@ namespace SceneManager.Utils
internal static void Direct(Vehicle nearbyVehicle, Path path, Waypoint targetWaypoint)
{
var nearbyVehiclesPath = PathManager.Paths.FirstOrDefault(p => p.CollectedPeds.Any(v => v.CurrentVehicle == nearbyVehicle));
var nearbyVehiclesPath = PathManager.Paths.FirstOrDefault(p => p != null && p.CollectedPeds.Any(v => v.CurrentVehicle == nearbyVehicle));
if(nearbyVehiclesPath == null)
{
Game.LogTrivial($"Nearby vehicle does not belong to any path.");