From a37365450054e206d5e588b47e5d8c4d102fbdcf Mon Sep 17 00:00:00 2001 From: Hugo Date: Thu, 16 Apr 2020 09:31:12 +0300 Subject: [PATCH] Return None if bio section is empty --- src/pylast/__init__.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/pylast/__init__.py b/src/pylast/__init__.py index 8495c58..5ddab60 100644 --- a/src/pylast/__init__.py +++ b/src/pylast/__init__.py @@ -1142,7 +1142,12 @@ class _BaseObject: def _extract_cdata_from_request(self, method_name, tag_name, params): doc = self._request(method_name, True, params) - return doc.getElementsByTagName(tag_name)[0].firstChild.wholeText.strip() + first_child = doc.getElementsByTagName(tag_name)[0].firstChild + + if first_child is None: + return None + + return first_child.wholeText.strip() def _get_things(self, method, thing, thing_type, params=None, cacheable=True): """Returns a list of the most played thing_types by this thing."""