Fix a crash for configs with no http block.
This commit is contained in:
parent
0af1e7036c
commit
9b17dbf8a2
1 changed files with 8 additions and 0 deletions
|
|
@ -552,6 +552,10 @@ ngx_int_t initWorkerProcess(ngx_cycle_t* cycle)
|
|||
auto mcf = (MainConf*)ngx_http_cycle_get_module_main_conf(
|
||||
cycle, gHttpModule);
|
||||
|
||||
if (mcf == NULL) {
|
||||
return NGX_OK;
|
||||
}
|
||||
|
||||
try {
|
||||
gExporter.reset(new BatchExporter(
|
||||
toStrView(mcf->endpoint),
|
||||
|
|
@ -591,6 +595,10 @@ ngx_int_t initWorkerProcess(ngx_cycle_t* cycle)
|
|||
|
||||
void exitWorkerProcess(ngx_cycle_t* cycle)
|
||||
{
|
||||
if (!gExporter) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
gExporter->flush();
|
||||
} catch (const std::exception& e) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue