diff --git a/PythonAPI/carla/agents/navigation/global_route_planner.py b/PythonAPI/carla/agents/navigation/global_route_planner.py index 2e7f73af8..56c3b6de2 100644 --- a/PythonAPI/carla/agents/navigation/global_route_planner.py +++ b/PythonAPI/carla/agents/navigation/global_route_planner.py @@ -227,7 +227,7 @@ class GlobalRoutePlanner(object): if not segment['entry'].is_junction: next_waypoint, next_road_option, next_segment = None, None, None - if waypoint.right_lane_marking.lane_change & carla.LaneChange.Right and not right_found: + if waypoint.right_lane_marking and waypoint.right_lane_marking.lane_change & carla.LaneChange.Right and not right_found: next_waypoint = waypoint.get_right_lane() if next_waypoint is not None \ and next_waypoint.lane_type == carla.LaneType.Driving \ @@ -240,7 +240,7 @@ class GlobalRoutePlanner(object): exit_waypoint=next_waypoint, intersection=False, exit_vector=None, path=[], length=0, type=next_road_option, change_waypoint=next_waypoint) right_found = True - if waypoint.left_lane_marking.lane_change & carla.LaneChange.Left and not left_found: + if waypoint.left_lane_marking and waypoint.left_lane_marking.lane_change & carla.LaneChange.Left and not left_found: next_waypoint = waypoint.get_left_lane() if next_waypoint is not None \ and next_waypoint.lane_type == carla.LaneType.Driving \