From 2f21de6a972a6e55b9f6e85616ea462ee3774490 Mon Sep 17 00:00:00 2001 From: PhenoM4n4n Date: Thu, 15 Apr 2021 17:39:49 -0700 Subject: [PATCH] lovecalc attributeerror --- lovecalculator/lovecalculator.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lovecalculator/lovecalculator.py b/lovecalculator/lovecalculator.py index 20504bd..a706ea0 100644 --- a/lovecalculator/lovecalculator.py +++ b/lovecalculator/lovecalculator.py @@ -49,7 +49,11 @@ class LoveCalculator(Cog): result_image = soup_object.find("img", class_="result__image").get("src") - result_text = soup_object.find("div", class_="result-text").get_text() + result_text = soup_object.find("div", class_="result-text") + if result_text is None: + result_text = f"{x} and {y} aren't compatible 😔" + else: + result_text.get_text() result_text = " ".join(result_text.split()) try: