瀏覽代碼

Better check for NULL in mg_connect()

Sergey Lyubka 13 年之前
父節點
當前提交
3602d54a5b
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      mongoose.c

+ 1 - 1
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));