From 6041a75bcc5eb81f9a69281ee733a6a5d23072dc Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Wed, 19 Jul 2023 13:05:14 +0200 Subject: [PATCH] Continued: - in case of database error (on their side), there is no navigation which lead here to a method invocation findAll() on NoneType --- fba/commands.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/fba/commands.py b/fba/commands.py index ae92ef6..76525c3 100644 --- a/fba/commands.py +++ b/fba/commands.py @@ -473,7 +473,13 @@ def fetch_observer(args: argparse.Namespace) -> int: doc = bs4.BeautifulSoup(raw, features="html.parser") logger.debug("doc[]='%s'", type(doc)) - items = doc.find("div", {"aria-labelledby": "navbarDropdownMenuSoftwares"}).findAll("a", {"class": "dropdown-item"}) + navbar = doc.find("div", {"aria-labelledby": "navbarDropdownMenuSoftwares"}) + logger.debug("navbar[]='%s'", type(navbar)) + if navbar is None: + logger.warning("Cannot find navigation bar, cannot continue!") + return 1 + + items = navbar.findAll("a", {"class": "dropdown-item"}) logger.debug("items[]='%s'", type(items)) logger.info("Checking %d menu items ...", len(items)) -- 2.39.5