From: Neale Ranns Date: Tue, 5 Dec 2017 21:34:36 +0000 (-0800) Subject: fix bug in pager X-Git-Tag: v18.04-rc0~107 X-Git-Url: https://gerrit.fd.io/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F37%2F9737%2F2;p=vpp.git fix bug in pager the format statement can return NULL before the pager has pages. Change-Id: Ibabfd107e64fc9ab0eb142c28c155506f0d25828 Signed-off-by: Neale Ranns --- diff --git a/src/vlib/unix/cli.c b/src/vlib/unix/cli.c index d484a0336f2..9f5862a036f 100644 --- a/src/vlib/unix/cli.c +++ b/src/vlib/unix/cli.c @@ -835,7 +835,7 @@ unix_cli_pager_redraw (unix_cli_file_t * cf, clib_file_t * uf) static void unix_cli_pager_add_line (unix_cli_file_t * cf, u8 * line, word len_or_index) { - u8 *p; + u8 *p = NULL; word i, j, k; word line_index, len; u32 width = cf->width; @@ -845,7 +845,8 @@ unix_cli_pager_add_line (unix_cli_file_t * cf, u8 * line, word len_or_index) { /* Use a line already in the pager buffer */ line_index = len_or_index; - p = cf->pager_vector[line_index]; + if (cf->pager_vector != NULL) + p = cf->pager_vector[line_index]; len = vec_len (p); } else