Skip to content

Commit

Permalink
Handle empty geojson features
Browse files Browse the repository at this point in the history
  • Loading branch information
hansthen committed Jan 17, 2024
1 parent b663546 commit 36143c4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion folium/features.py
Original file line number Diff line number Diff line change
Expand Up @@ -1137,7 +1137,11 @@ def render(self, **kwargs) -> None:
"""Renders the HTML representation of the element."""
figure = self.get_root()
if isinstance(self._parent, GeoJson):
keys = tuple(self._parent.data["features"][0]["properties"].keys())
keys = tuple(
self._parent.data["features"][0]["properties"].keys()
if self._parent.data["features"]
else []
)
self.warn_for_geometry_collections()
elif isinstance(self._parent, TopoJson):
obj_name = self._parent.object_path.split(".")[-1]
Expand Down

0 comments on commit 36143c4

Please sign in to comment.