blob: 2c83abf8d576b3afee3e0a93de19ef511899c540 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
https://bugs.gentoo.org/show_bug.cgi?id=566050#c2
--- a/src/paps.c
+++ b/src/paps.c
@@ -569,11 +569,14 @@
fclose (file);
- /* Add a trailing new line if it is missing */
- if (inbuf->str[inbuf->len-1] != '\n')
- g_string_append(inbuf, "\n");
+ if (inbuf->len) {
+ /* Add a trailing new line if it is missing */
+ if (inbuf->str[inbuf->len-1] != '\n')
+ g_string_append(inbuf, "\n");
- text = inbuf->str;
+ text = inbuf->str;
+ } else
+ text = g_strdup("\n");
g_string_free (inbuf, FALSE);
return text;
|