aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bin/psql/input.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/bin/psql/input.c b/src/bin/psql/input.c
index d84b64d1da8..2359b11dcdd 100644
--- a/src/bin/psql/input.c
+++ b/src/bin/psql/input.c
@@ -229,7 +229,7 @@ gets_fromFile(FILE *source)
}
/* EOL? */
- if (buffer->data[buffer->len - 1] == '\n')
+ if (buffer->len > 0 && buffer->data[buffer->len - 1] == '\n')
{
buffer->data[buffer->len - 1] = '\0';
return pg_strdup(buffer->data);