diff --git a/lib/pollfd.c b/lib/pollfd.c index 10fd8108..db7ae4a8 100644 --- a/lib/pollfd.c +++ b/lib/pollfd.c @@ -131,7 +131,11 @@ do_ext: int lws_change_pollfd(struct libwebsocket *wsi, int _and, int _or) { + if (!wsi || !wsi->protocol || wsi->position_in_fds_table < 0) + return 1; struct libwebsocket_context *context = wsi->protocol->owning_server; + if (!context) + return 1; int tid; int sampled_tid; struct libwebsocket_pollfd *pfd;