Skip to content

Commit 2f423f1

Browse files
committed
add nil check
1 parent 7ddcf17 commit 2f423f1

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

internal/collector/otel_collector_plugin.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,11 +160,16 @@ func (oc *Collector) processReceivers(ctx context.Context, receivers []config.Ot
160160
}
161161
}
162162

163+
// nolint: revive, cyclop
163164
func (oc *Collector) bootup(ctx context.Context) error {
164165
slog.InfoContext(ctx, "Starting OTel collector")
165166
errChan := make(chan error)
166167

167168
go func() {
169+
if oc.service == nil {
170+
errChan <- fmt.Errorf("unable to start OTel collector: service is nil")
171+
}
172+
168173
appErr := oc.service.Run(ctx)
169174
if appErr != nil {
170175
errChan <- appErr

0 commit comments

Comments
 (0)