[lib] vty_log shouldn't crash if called when vty isn't initiliased

2006-05-28 Paul Jakma <paul.jakma@sun.com>

	* vty.c: (vty_log/vty_log_fixed) dont crash if called when vty
	  hasn't been initiliased.
diff --git a/lib/vty.c b/lib/vty.c
index 7696915..b037c70 100644
--- a/lib/vty.c
+++ b/lib/vty.c
@@ -2404,6 +2404,9 @@
 {
   unsigned int i;
   struct vty *vty;
+  
+  if (!vtyvec)
+    return;
 
   for (i = 0; i < vector_active (vtyvec); i++)
     if ((vty = vector_slot (vtyvec, i)) != NULL)
@@ -2423,6 +2426,10 @@
   unsigned int i;
   struct iovec iov[2];
 
+  /* vty may not have been initialised */
+  if (!vtyvec)
+    return;
+  
   iov[0].iov_base = (void *)buf;
   iov[0].iov_len = len;
   iov[1].iov_base = (void *)"\r\n";