diff --git a/src/main/main.c b/src/main/main.c index 768f61c0e..6701d99d8 100644 --- a/src/main/main.c +++ b/src/main/main.c @@ -757,11 +757,12 @@ static int fd_poll(struct re *re) for (i = 0; (i < re->maxfds) && (cfds < nfds); i++) { fhs = re->fhsl[i]; - - ++cfds; + if (!fhs || !fhs->fh) continue; - + + ++cfds; + re_sock_t fd = fhs->fd; if (fhs->flags & FD_READ) FD_SET(fd, &rfds);