Blob Blame History Raw
diff -up patch-2.7.1/src/pch.c.me patch-2.7.1/src/pch.c
--- patch-2.7.1/src/pch.c.me	2018-11-22 14:09:28.099973290 +0100
+++ patch-2.7.1/src/pch.c	2018-11-22 14:17:57.741797271 +0100
@@ -2278,7 +2278,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;