Fix detection range calculation if TGO is empty

implement fix like in #1980
solves #2128
This commit is contained in:
RndName 2022-04-01 11:54:47 +02:00
parent 2274cef68c
commit ad8fef2fda
No known key found for this signature in database
GPG Key ID: 5EF516FD9537F7C0

View File

@ -192,7 +192,11 @@ class TheaterGroundObject(MissionTarget, SidcDescribable, ABC):
return max_range
def max_detection_range(self) -> Distance:
return max(self.detection_range(g) for g in self.groups)
return (
max(self.detection_range(g) for g in self.groups)
if self.groups
else meters(0)
)
def detection_range(self, group: TheaterGroup) -> Distance:
return self._max_range_of_type(group, "detection_range")