summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cmd.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/cmd.c b/cmd.c
index 0fb1ff57..198daa84 100644
--- a/cmd.c
+++ b/cmd.c
@@ -458,7 +458,8 @@ cmd_lookup_client(const char *name)
u_int i;
for (i = 0; i < ARRAY_LENGTH(&clients); i++) {
- if ((c = ARRAY_ITEM(&clients, i)) == NULL)
+ c = ARRAY_ITEM(&clients, i);
+ if (c == NULL || c->session == NULL)
continue;
path = c->tty.path;