From 59e8ec2a240efc89b44251c7681e6081c562850c Mon Sep 17 00:00:00 2001 From: Brian Duranleau Date: Fri, 21 Jun 2024 11:20:32 -0500 Subject: [PATCH] chore: check for NULL --- agent/lib_mongodb.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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