Fixes from LIU Xin.
diff --git a/isisd/ChangeLog b/isisd/ChangeLog
index 4c119e2..33608b1 100644
--- a/isisd/ChangeLog
+++ b/isisd/ChangeLog
@@ -1,3 +1,12 @@
+2004-09-10 LIU Xin <lx at ns.6test.edu.cn>
+	
+	* isis_pdu.c: Goto out only if no adjacency exist.
+	* isis_circuit.c: Don't crash while executing "isis circuit-type"
+	  command if circuit exists, but circuit->area is still NULL.
+	* isis_lsp.c: Set pointers to thread to NULL before initiating new
+	  thread in lsp_l1_refresh_pseudo(), lsp_l2_refresh_pseudo() and
+	  lsp_tick() functions.
+
 2004-05-19 Laurent Rabret <laurent.rabret at francetelecom.com>
 
 	* isis_constants.h: change the ISIS Hello interval from 1 to 10 (cisco's
diff --git a/isisd/isis_circuit.c b/isisd/isis_circuit.c
index 671ebbf..9a41c58 100644
--- a/isisd/isis_circuit.c
+++ b/isisd/isis_circuit.c
@@ -880,6 +880,10 @@
       return CMD_WARNING;
     }
 
+  /* XXX what to do when ip_router_isis is not executed */
+  if (circuit->area == NULL)
+    return CMD_WARNING;
+
   assert (circuit);
 
   circuit_t = string2circuit_t (argv[0]);
diff --git a/isisd/isis_lsp.c b/isisd/isis_lsp.c
index 214b438..677e2c3 100644
--- a/isisd/isis_lsp.c
+++ b/isisd/isis_lsp.c
@@ -2087,6 +2087,8 @@
   if (!circuit->u.bc.is_dr[0])
     return ISIS_ERROR;		/* FIXME: purge and such */
 
+  circuit->u.bc.t_refresh_pseudo_lsp[0] = NULL;
+
   retval = lsp_pseudo_regenerate (circuit, 1);
 
   ref_time = circuit->area->lsp_refresh[0] > MAX_LSP_GEN_INTERVAL ?
@@ -2145,6 +2147,8 @@
   if (!circuit->u.bc.is_dr[1])
     return ISIS_ERROR;		/* FIXME: purge and such */
 
+  circuit->u.bc.t_refresh_pseudo_lsp[1] = NULL;
+
   retval = lsp_pseudo_regenerate (circuit, 2);
 
   ref_time = circuit->area->lsp_refresh[1] > MAX_LSP_GEN_INTERVAL ?
@@ -2211,6 +2215,7 @@
 
   area = THREAD_ARG (thread);
   assert (area);
+  area->t_tick = NULL;
   THREAD_TIMER_ON (master, area->t_tick, lsp_tick, area, 1);
 
   /*
diff --git a/isisd/isis_pdu.c b/isisd/isis_pdu.c
index cae3461..c7142ee 100644
--- a/isisd/isis_pdu.c
+++ b/isisd/isis_pdu.c
@@ -812,8 +812,10 @@
        */
       adj = isis_new_adj (hdr.source_id, ssnpa, level, circuit);
       if (adj == NULL)
-	retval = ISIS_ERROR;
-      goto out;
+	{
+	  retval = ISIS_ERROR;
+	  goto out;
+	}
 
       adj->level = level;
       isis_adj_state_change (adj, ISIS_ADJ_INITIALIZING, NULL);