aboutsummaryrefslogtreecommitdiff
path: root/src/http/modules/ngx_http_map_module.c
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2006-10-20 19:07:50 +0000
committerIgor Sysoev <igor@sysoev.ru>2006-10-20 19:07:50 +0000
commit44d8bc2ff19385cf85c09bffdc21fe7a9eb19976 (patch)
treeaec7708481e10dd00beeb87a90eeaf8b24059e90 /src/http/modules/ngx_http_map_module.c
parent3d0a7168a943a5c02928b832b5e27f5a2d928699 (diff)
downloadnginx-44d8bc2ff19385cf85c09bffdc21fe7a9eb19976.tar.gz
nginx-44d8bc2ff19385cf85c09bffdc21fe7a9eb19976.zip
fix segfault if $server_addr failed
Diffstat (limited to 'src/http/modules/ngx_http_map_module.c')
-rw-r--r--src/http/modules/ngx_http_map_module.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/http/modules/ngx_http_map_module.c b/src/http/modules/ngx_http_map_module.c
index 0a533c0f5..fb8e8ee60 100644
--- a/src/http/modules/ngx_http_map_module.c
+++ b/src/http/modules/ngx_http_map_module.c
@@ -115,6 +115,11 @@ ngx_http_map_variable(ngx_http_request_t *r, ngx_http_variable_value_t *v,
vv = ngx_http_get_flushed_variable(r, map->index);
+ if (vv == NULL || vv->not_found) {
+ *v = *map->default_value;
+ return NGX_OK;
+ }
+
len = vv->len;
if (len && map->hostnames && vv->data[len - 1] == '.') {