Skip to content

Commit

Permalink
fix: incorrect nil logic for segments
Browse files Browse the repository at this point in the history
  • Loading branch information
iamemilio committed Feb 20, 2025
1 parent fe44ad6 commit 17ffd67
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 0 additions & 1 deletion v3/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ require (
google.golang.org/protobuf v1.34.2
)


retract v3.22.0 // release process error corrected in v3.22.1

retract v3.25.0 // release process error corrected in v3.25.1
Expand Down
6 changes: 5 additions & 1 deletion v3/newrelic/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,11 @@ func (txn *Transaction) startSegmentAt(at time.Time) SegmentStartTime {
// // ... code you want to time here ...
// segment.End()
func (txn *Transaction) StartSegment(name string) *Segment {
if IsSecurityAgentPresent() && nilTransaction(txn) && txn.thread.thread.threadID > 0 {
if nilTransaction(txn) {
return &Segment{} // return a non-nil Segment to avoid nil dereference
}

if IsSecurityAgentPresent() && txn.thread.thread != nil && txn.thread.thread.threadID > 0 {
// async segment start
secureAgent.SendEvent("NEW_GOROUTINE_LINKER", txn.thread.getCsecData())
}
Expand Down

0 comments on commit 17ffd67

Please sign in to comment.