From 81ce7fbb62aeb89edbc3170d365ac990ae929694 Mon Sep 17 00:00:00 2001 From: Dan Albert Date: Tue, 25 May 2021 19:19:45 -0700 Subject: [PATCH] Fix handling of empty polys in the new UI. This was copied from the Qt map and tweaked, but the use cases are slightly different so this needs to return an empty list for an empty polygon instead of None. Fixes https://github.com/dcs-liberation/dcs_liberation/issues/1121 --- qt_ui/widgets/map/mapmodel.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qt_ui/widgets/map/mapmodel.py b/qt_ui/widgets/map/mapmodel.py index a176c155..9268affc 100644 --- a/qt_ui/widgets/map/mapmodel.py +++ b/qt_ui/widgets/map/mapmodel.py @@ -52,9 +52,9 @@ LeafletLatLon = List[float] def shapely_poly_to_leaflet_points( poly: Polygon, theater: ConflictTheater -) -> Optional[List[LeafletLatLon]]: +) -> List[LeafletLatLon]: if poly.is_empty: - return None + return [] return [theater.point_to_ll(Point(x, y)).as_list() for x, y in poly.exterior.coords]