diff src/http/modules/ngx_http_map_module.c @ 797:36f7b549f481

fix segfault if $server_addr failed
author Igor Sysoev <igor@sysoev.ru>
date Fri, 20 Oct 2006 19:07:50 +0000
parents e60fe4cf1d4e
children 8ef04207c84f bf7814d77484
line wrap: on
line diff
--- 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
 
     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] == '.') {