vlib: Fix sh int addr
format_l2_input might return s=0 which
causes vlib_cli_output to print weird
things when calling sh int addr
Type: fix
Change-Id: I3fe747979355e41aed51656f3b44e0eb76d33ef9
Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
diff --git a/src/vlib/cli.c b/src/vlib/cli.c
index a88bd3a..68f16fc 100644
--- a/src/vlib/cli.c
+++ b/src/vlib/cli.c
@@ -703,6 +703,11 @@
s = va_format (0, fmt, &va);
va_end (va);
+ /* some format functions might return 0
+ * e.g. show int addr */
+ if (NULL == s)
+ return;
+
/* Terminate with \n if not present. */
if (vec_len (s) > 0 && s[vec_len (s) - 1] != '\n')
vec_add1 (s, '\n');