aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/vlib/unix/cli.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/vlib/unix/cli.c b/src/vlib/unix/cli.c
index 6e566d11ffd..2a13c84b92d 100644
--- a/src/vlib/unix/cli.c
+++ b/src/vlib/unix/cli.c
@@ -2557,7 +2557,8 @@ more:
format_timeval, 0 /* current bat-time */ ,
0 /* current bat-format */ ,
cli_file_index, cf->current_command);
- if (cf->current_command[vec_len (cf->current_command) - 1] != '\n')
+ if ((vec_len (cf->current_command) > 0) &&
+ (cf->current_command[vec_len (cf->current_command) - 1] != '\n'))
lv = format (lv, "\n");
int rv __attribute__ ((unused)) = write (um->log_fd, lv, vec_len (lv));
}