From e7e31c4512bdaf9f699b1fe4d4ac971112f8969b Mon Sep 17 00:00:00 2001 From: Marks Polakovs Date: Tue, 7 Apr 2020 13:32:46 +0200 Subject: [PATCH] so somehow this script hosed ob_state.conf? --- server.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server.py b/server.py index d660081..373cb02 100644 --- a/server.py +++ b/server.py @@ -25,7 +25,7 @@ def write_ob_status(status: bool) -> None: if "ws" in content: content = re.sub(file_contents_ex, "ws=" + str(1 if status else 0), content) else: - if content[len(content) - 1] != "\n": + if len(content) > 0 and content[len(content) - 1] != "\n": content += "\n" content += "ws=" + str(1 if status else 0) + "\n" fd.seek(0)