From 38837f5c4dac5c464f599e08fe5e540621041fed Mon Sep 17 00:00:00 2001 From: John Doty Date: Sun, 9 Jun 2024 07:12:14 -0700 Subject: [PATCH] Don't crash with empty lists --- harness.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/harness.py b/harness.py index 2db8606..ac61e70 100644 --- a/harness.py +++ b/harness.py @@ -738,7 +738,10 @@ class Harness: # Now that we know how many lines there are we can figure out how # many characters we need for the line number... - line_number_chars = int(math.log(len(lines), 10)) + 1 + if len(lines) > 0: + line_number_chars = int(math.log(len(lines), 10)) + 1 + else: + line_number_chars = 1 # ...which lets us wrap the lines appropriately. wrapper = textwrap.TextWrapper(