Don't crash when there is no match

This commit is contained in:
Edward Betts 2023-12-06 11:30:04 +00:00
parent ea95c82b37
commit fc0d6f114a

View file

@ -283,10 +283,15 @@ def article_page(url_title: str) -> str | Response:
by_title = {hit["title"]: hit for hit in hits} by_title = {hit["title"]: hit for hit in hits}
found = None
if article_title in by_title: if article_title in by_title:
hit = by_title[article_title] hit = by_title[article_title]
found = get_diff(from_title, hit["title"], None) try:
else: found = get_diff(from_title, hit["title"], None)
except NoMatch:
pass
if not found:
after = flask.request.args.get("after") after = flask.request.args.get("after")
if after: if after:
print(after) print(after)