@@ -894,13 +894,19 @@ static ngx_int_t ngx_http_clojure_module_init(ngx_cycle_t *cycle) {
894
894
895
895
ngx_core_conf_t * ccf = (ngx_core_conf_t * ) ngx_get_conf (cycle -> conf_ctx , ngx_core_module );
896
896
ngx_http_conf_ctx_t * ctx = (ngx_http_conf_ctx_t * )ngx_get_conf (cycle -> conf_ctx , ngx_http_module );
897
- ngx_http_clojure_main_conf_t * mcf = ctx -> main_conf [ngx_http_clojure_module .ctx_index ];
897
+ ngx_http_clojure_main_conf_t * mcf ;
898
+
898
899
#if !(NGX_WIN32 )
899
900
ngx_uint_t cl = 8 ;
900
901
ngx_uint_t ssize = 0 ;
901
902
#endif
902
903
ngx_http_clojure_global_cycle = cycle ;
903
904
905
+ if (ctx == NULL ) {
906
+ // No HTTP block in config
907
+ return NGX_OK ;
908
+ }
909
+ mcf = ctx -> main_conf [ngx_http_clojure_module .ctx_index ];
904
910
905
911
if (mcf -> jvm_path .len == NGX_CONF_UNSET_SIZE ) {
906
912
return NGX_OK ;
@@ -1022,6 +1028,10 @@ static ngx_int_t ngx_http_clojure_quit_master(ngx_cycle_t *cycle) {
1022
1028
static void ngx_http_clojure_process_exit (ngx_cycle_t * cycle ) {
1023
1029
ngx_http_clojure_main_conf_t * mcf = ngx_http_cycle_get_module_main_conf (cycle , ngx_http_clojure_module );
1024
1030
1031
+ if (mcf == NULL ) {
1032
+ return ;
1033
+ }
1034
+
1025
1035
if (mcf -> jvm_disable_all ) {
1026
1036
return ;
1027
1037
}
@@ -1122,12 +1132,21 @@ static ngx_int_t ngx_http_clojure_init_locations_handlers(ngx_http_core_main_con
1122
1132
static ngx_int_t ngx_http_clojure_process_init (ngx_cycle_t * cycle ) {
1123
1133
ngx_http_conf_ctx_t * ctx = (ngx_http_conf_ctx_t * )ngx_get_conf (cycle -> conf_ctx , ngx_http_module );
1124
1134
ngx_int_t rc = 0 ;
1125
- ngx_http_core_main_conf_t * cmcf = ctx -> main_conf [ngx_http_core_module .ctx_index ];
1126
- ngx_http_core_srv_conf_t * cscf = ctx -> srv_conf [ngx_http_core_module .ctx_index ];
1127
- ngx_http_clojure_main_conf_t * mcf = ctx -> main_conf [ngx_http_clojure_module .ctx_index ];
1135
+
1136
+ ngx_http_core_main_conf_t * cmcf ;
1137
+ ngx_http_core_srv_conf_t * cscf ;
1138
+ ngx_http_clojure_main_conf_t * mcf ;
1128
1139
ngx_core_conf_t * ccf = (ngx_core_conf_t * ) ngx_get_conf (cycle -> conf_ctx , ngx_core_module );
1129
1140
ngx_int_t jvm_num = 0 ;
1130
1141
1142
+ if (ctx == NULL ) {
1143
+ // No HTTP block in config
1144
+ return NGX_OK ;
1145
+ }
1146
+ cmcf = ctx -> main_conf [ngx_http_core_module .ctx_index ];
1147
+ cscf = ctx -> srv_conf [ngx_http_core_module .ctx_index ];
1148
+ mcf = ctx -> main_conf [ngx_http_clojure_module .ctx_index ];
1149
+
1131
1150
/*Fix issue #64 about proxy cache manger process
1132
1151
* We won't initialize jvm unless the current process is worker process or single process*/
1133
1152
if (ngx_process != NGX_PROCESS_WORKER && ngx_process != NGX_PROCESS_SINGLE ) {
0 commit comments