lws_protocol_vh_priv_get: fail gracefully with NULL vhost

This commit is contained in:
Andy Green 2017-09-15 11:27:03 +08:00
parent 98df6722ea
commit 59687e04e0

View file

@ -86,7 +86,7 @@ lws_protocol_vh_priv_get(struct lws_vhost *vhost, const struct lws_protocols *pr
{
int n = 0;
if (!vhost->protocol_vh_privs)
if (!vhost || !vhost->protocol_vh_privs)
return NULL;
while (n < vhost->count_protocols && &vhost->protocols[n] != prot)