Skip to content

Commit

Permalink
fix(plc4go/spi): don't panic when nil runnable is submitted to Worker…
Browse files Browse the repository at this point in the history
…Pool
  • Loading branch information
sruehl committed May 11, 2023
1 parent eefcef9 commit 2b029b4
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions plc4go/spi/utils/WorkerPool.go
Expand Up @@ -212,6 +212,11 @@ func WithExecutorOptionTracerWorkers(traceWorkers bool) ExecutorOption {
}

func (e *executor) Submit(ctx context.Context, workItemId int32, runnable Runnable) CompletionFuture {
if runnable == nil {
value := atomic.Value{}
value.Store(errors.New("runnable must not be nil"))
return &future{err: value}
}
log.Trace().Int32("workItemId", workItemId).Msg("Submitting runnable")
completionFuture := &future{}
select {
Expand Down

0 comments on commit 2b029b4

Please sign in to comment.