summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Chambers <andrewchamberss@gmail.com>2012-05-20 08:17:09 +0800
committerAndy Green <andy.green@linaro.org>2012-05-20 08:17:09 +0800
commitd5512179fc0eb0eb3a66818e0a63ffe95f3deef3 (patch)
tree5cac64bc74a860a7cef8e62624a92d2e122acb97
parent13f7791d0cecb607fa3dcf05a77d9da53fd41ffd (diff)
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> --
-rw-r--r--lib/libwebsockets.c13
1 files changed, 8 insertions, 5 deletions
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;