summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/pch.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/pch.c b/src/pch.c
index 94a0ac1..3ba5394 100644
--- a/src/pch.c
+++ b/src/pch.c
@@ -2276,7 +2276,7 @@ pfetch (lin line)
bool
pch_write_line (lin line, FILE *file)
{
- bool after_newline = p_line[line][p_len[line] - 1] == '\n';
+ bool after_newline = (p_len[line] > 0) && (p_line[line][p_len[line] - 1] == '\n');
if (! fwrite (p_line[line], sizeof (*p_line[line]), p_len[line], file))
write_fatal ();
return after_newline;