From 90178141eeae7dfd9930ca8bc5b98ae1e4164d51 Mon Sep 17 00:00:00 2001 From: Michael Lazar Date: Sat, 7 Apr 2018 15:20:32 -0400 Subject: [PATCH] Catch unexpected null-byte errors when adding strings to curses --- rtv/terminal.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rtv/terminal.py b/rtv/terminal.py index 9d8d3d1..85c507b 100644 --- a/rtv/terminal.py +++ b/rtv/terminal.py @@ -275,7 +275,8 @@ class Terminal(object): text = self.clean(text, n_cols) params = [] if attr is None else [attr] window.addstr(row, col, text, *params) - except curses.error as e: + except (curses.error, ValueError) as e: + # window.addstr could raise "ValueError: embedded null byte" _logger.warning('add_line raised an exception') _logger.exception(str(e))