vtysh: handle case if there is no match in "write terminal $daemon"

While the DEFUN should match the list of clients registered in
vtysh, it seems better to handle the case explicitly instead of
relying on the client list and the DEFUN signature being in sync.

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>
diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c
index 75d1fc0..23653f0 100644
--- a/vtysh/vtysh.c
+++ b/vtysh/vtysh.c
@@ -1899,6 +1899,9 @@
 	break;
     }
 
+  if (i == array_size(vtysh_client))
+    return CMD_ERR_NO_MATCH;
+
   ret = vtysh_client_execute(&vtysh_client[i], "show running-config\n", stdout);
 
   return ret;