Fixed invalid divider chars crashing page rendering

This commit is contained in:
Mark Qvist 2026-09-27 14:30:47 +02:00
parent cfe23af68d
commit 9d24271090
No known key found for this signature in database

View file

@ -603,14 +603,14 @@ def parse_line(line, state, url_delegate):
if len(line) == 2:
divider_char = line[1]
# Control characters don't make sense here and otherwise crash nomadnet
if ord(divider_char) < 32:
divider_char = "\u2500"
else:
divider_char = "\u2500"
if state["depth"] == 0:
return [urwid.Divider(divider_char)]
else:
return [urwid.Padding(urwid.Divider(divider_char), left=left_indent(state), right=right_indent(state))]
if ord(divider_char) < 32: divider_char = "\u2500"
# Check if the divider char is renderable
try: urwid.Divider(divider_char).render((30,))
except Exception as e: divider_char = "\u2500"
else: divider_char = "\u2500"
if state["depth"] == 0: return [urwid.Divider(divider_char)]
else: return [urwid.Padding(urwid.Divider(divider_char), left=left_indent(state), right=right_indent(state))]
output = make_output(state, line, url_delegate, pre_escape)