aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--edit.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/edit.py b/edit.py
index 5075ddc..bbabb7e 100644
--- a/edit.py
+++ b/edit.py
@@ -68,7 +68,7 @@ def read_file(buf):
with open(FILE) as f:
text = f.read()
- if text[-1] == "\n":
+ if text and text[-1] == "\n":
text = text[:-1] # remove trailing newline if exists.
if FENCED:
text = "```\n" + text + "\n```"