From a7cfb89c2a03e155e0f6b6ad19de3b25d09f157b Mon Sep 17 00:00:00 2001 From: David Halter Date: Fri, 19 Jul 2013 00:15:09 +0200 Subject: [PATCH] fix a sith problem with empty files --- sith.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sith.py b/sith.py index 022198ff..2c2992e8 100755 --- a/sith.py +++ b/sith.py @@ -89,7 +89,9 @@ class TestCase(object): source = f.read() lines = source.splitlines() - line = random.randint(1, max(len(lines), 1)) + if not lines: + lines = [''] + line = random.randint(1, len(lines)) column = random.randint(0, len(lines[line - 1])) return cls(operation, path, line, column)