changeset 3257:8bd88de8fecd

fix segfault if http {} block is empty, the bug had been introduced in r3218
author Igor Sysoev <igor@sysoev.ru>
date Wed, 28 Oct 2009 10:45:40 +0000
parents 0df898363248
children 77db9440d970
files src/http/ngx_http.c
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/http/ngx_http.c
+++ b/src/http/ngx_http.c
@@ -1352,6 +1352,10 @@ ngx_http_optimize_servers(ngx_conf_t *cf
     ngx_http_conf_port_t  *port;
     ngx_http_conf_addr_t  *addr;
 
+    if (ports == NULL) {
+        return NGX_OK;
+    }
+
     port = ports->elts;
     for (p = 0; p < ports->nelts; p++) {