From 3602d54a5b5918ca902e6aa3ac88dd9fb65a3f0a Mon Sep 17 00:00:00 2001 From: Sergey Lyubka Date: Mon, 3 Sep 2012 22:36:40 +0100 Subject: [PATCH] Better check for NULL in mg_connect() --- mongoose.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mongoose.c b/mongoose.c index 976870d3..565038eb 100644 --- a/mongoose.c +++ b/mongoose.c @@ -3981,7 +3981,7 @@ struct mg_connection *mg_connect(struct mg_context *ctx, struct hostent *he; int sock; - if (ctx->client_ssl_ctx == NULL && use_ssl) { + if (use_ssl && (ctx == NULL || ctx->client_ssl_ctx == NULL)) { cry(fc(ctx), "%s: SSL is not initialized", __func__); } else if ((he = gethostbyname(host)) == NULL) { cry(fc(ctx), "%s: gethostbyname(%s): %s", __func__, host, strerror(ERRNO));