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/utils/ai_recommendations.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'code/utils/ai_recommendations.py') diff --git a/code/utils/ai_recommendations.py b/code/utils/ai_recommendations.py index 68764bc..2fc71d3 100644 --- a/code/utils/ai_recommendations.py +++ b/code/utils/ai_recommendations.py @@ -62,14 +62,14 @@ async def add_song_recommendations( ytsearch = f"ytsearch:{song} by {artist} audio" results = await player.node.get_tracks(ytsearch) - if not results.tracks or results.load_type in ( + if not (results and results.tracks) or results.load_type in ( LoadType.EMPTY, LoadType.ERROR, ): dzsearch = f"dzsearch:{song}" results = await player.node.get_tracks(dzsearch) - 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