From 78ebd842755154c03c950ccbb8ec5b5033936ec6 Mon Sep 17 00:00:00 2001 From: Parker Date: Sun, 15 Dec 2024 22:44:38 -0600 Subject: Protect against `results` being `None` --- code/cogs/play.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'code/cogs/play.py') diff --git a/code/cogs/play.py b/code/cogs/play.py index 1756141..2e07486 100644 --- a/code/cogs/play.py +++ b/code/cogs/play.py @@ -63,7 +63,7 @@ class Play(commands.Cog): dzsearch = f"dzsearch:{query}" results = await player.node.get_tracks(dzsearch) # If Deezer returned nothing - if not results.tracks or results.load_type in ( + if not (results and results.tracks) or results.load_type in ( LoadType.EMPTY, LoadType.ERROR, ): @@ -71,7 +71,9 @@ class Play(commands.Cog): ytmsearch = f"ytmsearch:{query}" results = await player.node.get_tracks(ytmsearch) # If YouTube Music returned nothing - if not results.tracks or results.load_type in ( + if not ( + results and results.tracks + ) or results.load_type in ( LoadType.EMPTY, LoadType.ERROR, ): @@ -82,7 +84,7 @@ class Play(commands.Cog): results = await player.node.get_tracks(query) # If there are no results found, set results/embed to None, handled further down - if not results.tracks or results.load_type in ( + if not (results and results.tracks) or results.load_type in ( LoadType.EMPTY, LoadType.ERROR, ): -- cgit v1.2.3-70-g09d2