updated for version 7.0-166
diff --git a/src/if_cscope.c b/src/if_cscope.c
index f796cd9..8866435 100644
--- a/src/if_cscope.c
+++ b/src/if_cscope.c
@@ -1008,7 +1008,7 @@
     totmatches = 0;
     for (i = 0; i < CSCOPE_MAX_CONNECTIONS; i++)
     {
-	if (csinfo[i].fname == NULL)
+	if (csinfo[i].fname == NULL || csinfo[i].to_fp == NULL)
 	    continue;
 
 	/* send cmd to cscope */
diff --git a/src/version.c b/src/version.c
index eb55641..f0bb45a 100644
--- a/src/version.c
+++ b/src/version.c
@@ -667,6 +667,8 @@
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    166,
+/**/
     165,
 /**/
     164,