Skip to content

Commit b674d21

Browse files
committed
fix: division by zero if there are no authors
1 parent 35a5245 commit b674d21

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

plugins/hardcover/src/hardcover/identifier.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,9 @@ def _filter_editions_by_author(
149149
f"weighted similarity between {authors} and {edition_author}: {weighted_similarity}"
150150
)
151151
total_similarity += weighted_similarity
152-
similarity = total_similarity / len(edition_authors)
152+
similarity = 0.0
153+
if edition_authors:
154+
similarity = total_similarity / len(edition_authors)
153155
self.log.debug(
154156
f"overall similarity for {edition.title} ({edition.id}): {similarity}"
155157
)

0 commit comments

Comments
 (0)