From e52c20b9e79d2004e901b4ef31ef42f2ea1444ed Mon Sep 17 00:00:00 2001 From: Draper <27962761+Drapersniper@users.noreply.github.com> Date: Sun, 12 Jan 2020 21:20:46 +0000 Subject: [PATCH] [Audio] Hotfix an edge case where an attribute error can be raised (#3328) * Limit Playlists Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com> * Hotfix Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com> * Hotfix Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com> --- changelog.d/audio/3328.hotfix.1.rst | 1 + redbot/cogs/audio/apis.py | 2 ++ redbot/cogs/audio/databases.py | 2 ++ 3 files changed, 5 insertions(+) create mode 100644 changelog.d/audio/3328.hotfix.1.rst diff --git a/changelog.d/audio/3328.hotfix.1.rst b/changelog.d/audio/3328.hotfix.1.rst new file mode 100644 index 000000000..08e7ed7b9 --- /dev/null +++ b/changelog.d/audio/3328.hotfix.1.rst @@ -0,0 +1 @@ +Fixed an attribute error that can be raised on play commands for spotify tracks. \ No newline at end of file diff --git a/redbot/cogs/audio/apis.py b/redbot/cogs/audio/apis.py index eb6dbd7c0..87745d5ce 100644 --- a/redbot/cogs/audio/apis.py +++ b/redbot/cogs/audio/apis.py @@ -750,6 +750,8 @@ class MusicCache: log.debug(f"Querying Local Database for {query}") task = ("update", ("lavalink", {"query": query})) self.append_task(ctx, *task) + else: + val = None if val and not forced: data = val data["query"] = query diff --git a/redbot/cogs/audio/databases.py b/redbot/cogs/audio/databases.py index 6951a91b7..ee136c222 100644 --- a/redbot/cogs/audio/databases.py +++ b/redbot/cogs/audio/databases.py @@ -91,6 +91,8 @@ class CacheFetchResult: k in self.query for k in ["loadType", "playlistInfo", "isSeekable", "isStream"] ): self.query = json.loads(self.query) + else: + self.query = None @dataclass