Fix a crash for configs with no http block.
This commit is contained in:
parent
5f611a0fc8
commit
387d391823
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(
|
auto mcf = (MainConf*)ngx_http_cycle_get_module_main_conf(
|
||||||
cycle, gHttpModule);
|
cycle, gHttpModule);
|
||||||
|
|
||||||
|
if (mcf == NULL) {
|
||||||
|
return NGX_OK;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
gExporter.reset(new BatchExporter(
|
gExporter.reset(new BatchExporter(
|
||||||
toStrView(mcf->endpoint),
|
toStrView(mcf->endpoint),
|
||||||
|
|
@ -591,6 +595,10 @@ ngx_int_t initWorkerProcess(ngx_cycle_t* cycle)
|
||||||
|
|
||||||
void exitWorkerProcess(ngx_cycle_t* cycle)
|
void exitWorkerProcess(ngx_cycle_t* cycle)
|
||||||
{
|
{
|
||||||
|
if (!gExporter) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
gExporter->flush();
|
gExporter->flush();
|
||||||
} catch (const std::exception& e) {
|
} catch (const std::exception& e) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue