From 48f53bcc000fb73b3fd68f051a3c3c9a80b78b02 Mon Sep 17 00:00:00 2001 From: Shuanglei Tao Date: Tue, 10 Mar 2020 09:41:35 +0800 Subject: [PATCH] protocol: fix lws callback compatibility --- src/protocol.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/protocol.c b/src/protocol.c index 478c0df..aa7eeb6 100644 --- a/src/protocol.c +++ b/src/protocol.c @@ -419,6 +419,9 @@ callback_tty(struct lws *wsi, enum lws_callback_reasons reason, break; case LWS_CALLBACK_CLOSED: + if (pss->wsi == NULL) + break; + server->client_count--; lwsl_notice("WS closed from %s, clients: %d\n", pss->address, server->client_count); if (pss->buffer != NULL) { -- 2.43.4