When creating a context with NULL extensions list,
a segmentation fault was yelled when trying to
destroy the context. This checks if the
extension list is NULL before go through the list.
Signed-off-by: Paulo Roberto Urio <paulourio@gmail.com>
m = LWS_EXT_CALLBACK_CLIENT_CONTEXT_DESTRUCT;
if (context->listen_port)
m = LWS_EXT_CALLBACK_SERVER_CONTEXT_DESTRUCT;
- while (ext->callback) {
+ while (ext && ext->callback) {
ext->callback(context, ext, NULL, m, NULL, NULL, 0);
ext++;
}