From 112941b944b5f588ad671d59cc4f73e9b5ef2d10 Mon Sep 17 00:00:00 2001 From: Rahul Ahuja Date: Fri, 6 Sep 2019 17:24:26 -0700 Subject: [PATCH] Guard against None match --- beets/autotag/__init__.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/beets/autotag/__init__.py b/beets/autotag/__init__.py index cec63ade1..8c0e62067 100644 --- a/beets/autotag/__init__.py +++ b/beets/autotag/__init__.py @@ -302,8 +302,11 @@ class APIAutotaggerPlugin(object): u"Searching {} for {} '{}'", self.data_source, url_type, id_ ) match = re.search(self.id_regex['pattern'].format(url_type), str(id_)) - id_ = match.group(self.id_regex['match_group']) - return id_ if id_ else None + if match: + id_ = match.group(self.id_regex['match_group']) + if id_: + return id_ + return None def candidates(self, items, artist, album, va_likely): """Returns a list of AlbumInfo objects for Search API results