diff --git a/field_friend/automations/field_provider.py b/field_friend/automations/field_provider.py index 26c0329e..9177f2d4 100644 --- a/field_friend/automations/field_provider.py +++ b/field_friend/automations/field_provider.py @@ -167,5 +167,7 @@ def get_rows_to_work_on(self) -> list[Row]: def is_row_in_selected_beds(self, row_index: int) -> bool: if not self._only_specific_beds: return True + if self.selected_field is None: + return False bed_index = row_index // self.selected_field.row_count + 1 return bed_index in self.selected_beds diff --git a/field_friend/automations/navigation/field_navigation.py b/field_friend/automations/navigation/field_navigation.py index 51f43d8b..99a3ef3b 100644 --- a/field_friend/automations/navigation/field_navigation.py +++ b/field_friend/automations/navigation/field_navigation.py @@ -93,7 +93,7 @@ async def finish(self) -> None: self.automation_watcher.stop_field_watch() await self.implement.deactivate() - def get_nearest_row(self) -> Row: + def get_nearest_row(self) -> Row | None: assert self.field is not None assert self.gnss.device is not None row = min(self.field.rows, key=lambda r: r.line_segment().line.foot_point(