You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by sr...@apache.org on 2023/05/11 12:30:42 UTC

[plc4x] branch develop updated: fix(plc4go/spi): don't panic when nil runnable is submitted to WorkerPool

This is an automated email from the ASF dual-hosted git repository.

sruehl pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git


The following commit(s) were added to refs/heads/develop by this push:
     new 2b029b4586 fix(plc4go/spi): don't panic when nil runnable is submitted to WorkerPool
2b029b4586 is described below

commit 2b029b45860f4c5d13a8865cd1e9ca0121e4f150
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Thu May 11 14:30:33 2023 +0200

    fix(plc4go/spi): don't panic when nil runnable is submitted to WorkerPool
---
 plc4go/spi/utils/WorkerPool.go | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/plc4go/spi/utils/WorkerPool.go b/plc4go/spi/utils/WorkerPool.go
index 781b10b433..578b0d38e8 100644
--- a/plc4go/spi/utils/WorkerPool.go
+++ b/plc4go/spi/utils/WorkerPool.go
@@ -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 {