summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common/readline.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/common/readline.c b/common/readline.c
index f637b64d..4f55e99c 100644
--- a/common/readline.c
+++ b/common/readline.c
@@ -58,7 +58,7 @@ char *peek_line(FILE *file, int offset, long *position) {
58 if (read < 0) { 58 if (read < 0) {
59 break; 59 break;
60 } 60 }
61 if (line[read - 1] == '\n') { 61 if (read > 0 && line[read - 1] == '\n') {
62 line[read - 1] = '\0'; 62 line[read - 1] = '\0';
63 } 63 }
64 } 64 }