diff --git a/agent/lib_mongodb.c b/agent/lib_mongodb.c index cd792b463..471ad747f 100644 --- a/agent/lib_mongodb.c +++ b/agent/lib_mongodb.c @@ -179,9 +179,11 @@ NR_PHP_WRAPPER_END NR_PHP_WRAPPER(nr_mongodb_operation_before) { (void)wraprec; - nr_segment_t* segment; + nr_segment_t* segment = NULL; segment = nr_segment_start(NRPRG(txn), NULL, NULL); - segment->wraprec = auto_segment->wraprec; + if (NULL != segment) { + segment->wraprec = auto_segment->wraprec; + } } NR_PHP_WRAPPER_END