From: Andrew Chambers Date: Sun, 20 May 2012 00:17:09 +0000 (+0800) Subject: null exception with null extensions list X-Git-Tag: 1.2~9 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d5512179fc0eb0eb3a66818e0a63ffe95f3deef3;p=profile%2Fivi%2Flibwebsockets.git 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 -- --- diff --git a/lib/libwebsockets.c b/lib/libwebsockets.c index 5a28f30..4b5ec8b 100644 --- a/lib/libwebsockets.c +++ b/lib/libwebsockets.c @@ -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;