null exception with null extensions list

I was under the impression extensions could be null, so heres a patch to fix this error in libwebsockets. Cheers!

Signed-off-by: Andrew Chambers <andrewchamberss@gmail.com>

--
This commit is contained in:
Andrew Chambers 2012-05-20 08:17:09 +08:00 committed by Andy Green
parent 13f7791d0c
commit d5512179fc

View file

@ -2946,11 +2946,14 @@ libwebsocket_create_context(int port, const char *interf,
m = LWS_EXT_CALLBACK_CLIENT_CONTEXT_CONSTRUCT;
if (port)
m = LWS_EXT_CALLBACK_SERVER_CONTEXT_CONSTRUCT;
while (extensions->callback) {
debug(" Extension: %s\n", extensions->name);
extensions->callback(context, extensions,
NULL, m, NULL, NULL, 0);
extensions++;
if (extensions) {
while (extensions->callback) {
debug(" Extension: %s\n", extensions->name);
extensions->callback(context, extensions,
NULL, m, NULL, NULL, 0);
extensions++;
}
}
return context;