mirror of
https://github.com/markqvist/NomadNet.git
synced 2026-10-25 18:40:13 -04:00
Fixed invalid divider chars crashing page rendering
This commit is contained in:
parent
cfe23af68d
commit
9d24271090
1 changed files with 8 additions and 8 deletions
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue