diff --git a/telebot/util.py b/telebot/util.py index 485d8e6..e52ee83 100644 --- a/telebot/util.py +++ b/telebot/util.py @@ -399,7 +399,10 @@ def escape(text: str) -> str: :return: the escaped text """ chars = {"&": "&", "<": "<", ">": ">"} - for old, new in chars.items(): text = text.replace(old, new) + if text is None: + return None + for old, new in chars.items(): + text = text.replace(old, new) return text