Skip to content

Commit f6bc345

Browse files
authored
fix: add nil check for Tracker (#810)
Signed-off-by: Rui Chen <[email protected]>
1 parent 5311cfb commit f6bc345

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

app/cli/internal/telemetry/posthog/posthog.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ type Tracker struct {
5353

5454
// TrackEvent sends an event to the PostHog server.
5555
func (p *Tracker) TrackEvent(_ context.Context, eventName string, id string, tags telemetry.Tags) error {
56+
if p == nil {
57+
return nil
58+
}
59+
5660
defer p.client.Close()
5761
msg := posthog.Capture{
5862
DistinctId: id,

0 commit comments

Comments
 (0)