From 1e5e38d8a80658cc60a425ee9be7b4ea314e54ad Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Thu, 23 Mar 2023 18:56:36 +0000 Subject: [PATCH] Check for none --- webapp_utils.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/webapp_utils.py b/webapp_utils.py index 231d555aa..2776998f0 100644 --- a/webapp_utils.py +++ b/webapp_utils.py @@ -2041,10 +2041,11 @@ def html_common_emoji(base_dir: str, no_of_emoji: int) -> str: def text_mode_browser(ua_str: str) -> bool: """Does the user agent indicate a text mode browser? """ - text_mode_agents = ('Lynx/', 'w3m/', 'Links (', 'Emacs/', 'ELinks') - for agent in text_mode_agents: - if agent in ua_str: - return True + if ua_str: + text_mode_agents = ('Lynx/', 'w3m/', 'Links (', 'Emacs/', 'ELinks') + for agent in text_mode_agents: + if agent in ua_str: + return True return False