From f6440aa17352d69b6010867bc1620d4c1b475ecb Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Thu, 20 May 2021 15:37:26 -0700 Subject: [PATCH] Correctly handles openlibrary works with no editions --- bookwyrm/connectors/openlibrary.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bookwyrm/connectors/openlibrary.py b/bookwyrm/connectors/openlibrary.py index 69d498b8..c4d784ab 100644 --- a/bookwyrm/connectors/openlibrary.py +++ b/bookwyrm/connectors/openlibrary.py @@ -76,7 +76,10 @@ class Connector(AbstractConnector): raise ConnectorException("Invalid book data") url = "%s%s/editions" % (self.books_url, key) data = get_data(url) - return pick_default_edition(data["entries"]) + edition = pick_default_edition(data["entries"]) + if not edition: + raise ConnectorException("No editions for work") + return edition def get_work_from_edition_data(self, data): try: