From b48f2a1eff20996901e8db40d68c880a5d7f053f Mon Sep 17 00:00:00 2001 From: Parker Date: Wed, 22 Jan 2025 16:03:57 -0600 Subject: [PATCH] Safety check --- code/cogs/status.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/code/cogs/status.py b/code/cogs/status.py index 769fc8f..ef044cc 100644 --- a/code/cogs/status.py +++ b/code/cogs/status.py @@ -200,13 +200,15 @@ class Status(commands.Cog): session.commit() # If series and only a portion of episodes have been downloaded - if data.get("statistics").get("percentOfEpisodes"): - description += ( - f"\n**{title} ({release_year})** - Status: `NOT" - " FOUND" - f" ({int(data['statistics']['percentOfEpisodes'])}%" - " of eps.)`" - ) + # If data["statistics"] exists and is not None + if "statistics" in data and data["statistics"] != None: + if "percentOfEpisodes" in data["statistics"]: + description += ( + f"\n**{title} ({release_year})** - Status: `NOT" + " FOUND" + f" ({int(data['statistics']['percentOfEpisodes'])}%" + " of eps.)`" + ) # All other scenarios, download not found else: description += (