1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

Fixed #34088 -- Fixed Sitemap.get_latest_lastmod() crash with empty items.

Bug in 480191244d.

Thanks Michal Čihař for the report.
This commit is contained in:
Daniel Ivanov
2022-11-04 16:43:40 +03:00
committed by Mariusz Felisiak
parent 444b6da7cc
commit 5eab4d1924
4 changed files with 35 additions and 1 deletions

View File

@@ -167,7 +167,7 @@ class Sitemap:
return None
if callable(self.lastmod):
try:
return max([self.lastmod(item) for item in self.items()])
return max([self.lastmod(item) for item in self.items()], default=None)
except TypeError:
return None
else: