Skip to content

Commit 5be5d2e

Browse files
author
Pietro Albini
committed
Fix /help command crash if a command doesn't have docstrings
This was caused by commit 7046c49, which escapes automatically docstrings without HTML in them. The problem was, the check if the docstring contained HTML was done even if there was no string, causing issues because you can't do the checks on None. Regression-of: 7046c49
1 parent e0a91a0 commit 5be5d2e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

botogram/defaults.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,10 @@ def no_commands_hook(self, bot, chat, message):
158158

159159
def escape_html(text):
160160
"""Escape a docstring"""
161+
# You can't escape None, right?
162+
if text is None:
163+
return
164+
161165
# The docstring is escaped only if it doesn't contain HTML markup
162166
if not syntaxes.is_html(text):
163167
return html.escape(text)

0 commit comments

Comments
 (0)