From b9e781c01d299995ea272e799c3e2ed911938d2b Mon Sep 17 00:00:00 2001 From: nsubiron Date: Thu, 28 Sep 2017 11:35:08 +0200 Subject: [PATCH] Fix crash in simulation mode --- Source/Carla/AI/WheeledVehicleAIController.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Source/Carla/AI/WheeledVehicleAIController.cpp b/Source/Carla/AI/WheeledVehicleAIController.cpp index d8eb510e9..51477c99f 100644 --- a/Source/Carla/AI/WheeledVehicleAIController.cpp +++ b/Source/Carla/AI/WheeledVehicleAIController.cpp @@ -139,7 +139,15 @@ void AWheeledVehicleAIController::SetFixedRoute(const TArray &Locations void AWheeledVehicleAIController::TickAutopilotController() { +#if WITH_EDITOR + if (Vehicle == nullptr) { // This happens in simulation mode in editor. + bAutopilotEnabled = false; + return; + } +#endif // WITH_EDITOR + check(Vehicle != nullptr); + if (RoadMap == nullptr) { UE_LOG(LogCarla, Error, TEXT("Controller doesn't have a road map!")); return;