@@ -2938,7 +2938,7 @@ ngx_int_t ps_preaccess_handler(ngx_http_request_t* r) {
29382938ngx_int_t ps_etag_filter_init (ngx_conf_t * cf) {
29392939 ps_main_conf_t * cfg_m = static_cast <ps_main_conf_t *>(
29402940 ngx_http_conf_get_module_main_conf (cf, ngx_pagespeed));
2941- if (cfg_m->driver_factory != NULL ) {
2941+ if (cfg_m != NULL && cfg_m ->driver_factory != NULL ) {
29422942 ngx_http_ef_next_header_filter = ngx_http_top_header_filter;
29432943 ngx_http_top_header_filter = ps_etag_header_filter;
29442944 }
@@ -3020,6 +3020,11 @@ ngx_int_t ps_init_module(ngx_cycle_t* cycle) {
30203020 ps_main_conf_t * cfg_m = static_cast <ps_main_conf_t *>(
30213021 ngx_http_cycle_get_module_main_conf (cycle, ngx_pagespeed));
30223022
3023+ // See https://github.com/pagespeed/ngx_pagespeed/issues/1220
3024+ if (cfg_m == NULL ) {
3025+ return NGX_OK;
3026+ }
3027+
30233028 ngx_http_core_main_conf_t * cmcf = static_cast <ngx_http_core_main_conf_t *>(
30243029 ngx_http_cycle_get_module_main_conf (cycle, ngx_http_core_module));
30253030 ngx_http_core_srv_conf_t ** cscfp = static_cast <ngx_http_core_srv_conf_t **>(
@@ -3087,7 +3092,7 @@ void ps_exit_child_process(ngx_cycle_t* cycle) {
30873092 ps_main_conf_t * cfg_m = static_cast <ps_main_conf_t *>(
30883093 ngx_http_cycle_get_module_main_conf (cycle, ngx_pagespeed));
30893094 NgxBaseFetch::Terminate ();
3090- if (cfg_m->driver_factory != NULL ) {
3095+ if (cfg_m != NULL && cfg_m ->driver_factory != NULL ) {
30913096 cfg_m->driver_factory ->ShutDown ();
30923097 }
30933098}
@@ -3097,7 +3102,7 @@ void ps_exit_child_process(ngx_cycle_t* cycle) {
30973102ngx_int_t ps_init_child_process (ngx_cycle_t * cycle) {
30983103 ps_main_conf_t * cfg_m = static_cast <ps_main_conf_t *>(
30993104 ngx_http_cycle_get_module_main_conf (cycle, ngx_pagespeed));
3100- if (cfg_m->driver_factory == NULL ) {
3105+ if (cfg_m == NULL || cfg_m ->driver_factory == NULL ) {
31013106 return NGX_OK;
31023107 }
31033108
0 commit comments