1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00

coverity 169270: client: handle NULL protocol

This commit is contained in:
Andy Green 2018-03-19 07:55:01 +08:00
parent 0e8b3fed12
commit 3775ac9d2e

View file

@ -876,7 +876,7 @@ lws_client_interpret_server_handshake(struct lws *wsi)
n = 0;
while (wsi->vhost->protocols[n].callback) {
if (strcmp(wsi->protocol->name,
if (wsi->protocol && strcmp(wsi->protocol->name,
wsi->vhost->protocols[n].name) == 0) {
wsi->protocol = &wsi->vhost->protocols[n];
break;
@ -885,7 +885,10 @@ lws_client_interpret_server_handshake(struct lws *wsi)
}
if (!wsi->vhost->protocols[n].callback) {
lwsl_err("Failed to match protocol %s\n", wsi->protocol->name);
if (wsi->protocol)
lwsl_err("Failed to match protocol %s\n", wsi->protocol->name);
else
lwsl_err("No protocol on client\n");
goto bail2;
}
}