From 717a645d9d52952ea9dd067c7acddeb64f6ac152 Mon Sep 17 00:00:00 2001 From: Val Date: Sun, 14 Aug 2022 23:08:50 -0500 Subject: [PATCH] Check the length of the line before indexing --- 17-Chernobyl/Code/hashbrek.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/17-Chernobyl/Code/hashbrek.py b/17-Chernobyl/Code/hashbrek.py index 0353b99..1e69e5c 100644 --- a/17-Chernobyl/Code/hashbrek.py +++ b/17-Chernobyl/Code/hashbrek.py @@ -13,7 +13,7 @@ def hash(byts): while True: try: line = input("> ") - if (line[0] == '~'): + if (len(line) and line[0] == '~'): h = hash(bytes.fromhex(line[1:])); else: h = hash(line.encode())