Skip to content

Commit

Permalink
fix(plc4go/spi): don't panic if sub handle is not found
Browse files Browse the repository at this point in the history
  • Loading branch information
sruehl committed May 16, 2023
1 parent 1c97823 commit 4c76916
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion plc4go/spi/model/DefaultPlcSubscriptionResponse.go
Expand Up @@ -21,6 +21,7 @@ package model

import (
"github.com/pkg/errors"
"github.com/rs/zerolog/log"

apiModel "github.com/apache/plc4x/plc4go/pkg/api/model"
)
Expand All @@ -44,7 +45,8 @@ func NewDefaultPlcSubscriptionResponse(request apiModel.PlcSubscriptionRequest,
for subscriptionTagName, consumers := range request.(*DefaultPlcSubscriptionRequest).preRegisteredConsumers {
subscriptionHandle, err := plcSubscriptionResponse.GetSubscriptionHandle(subscriptionTagName)
if subscriptionHandle == nil || err != nil {
panic("PlcSubscriptionHandle for " + subscriptionTagName + " not found")
log.Error().Msgf("PlcSubscriptionHandle for %s not found", subscriptionTagName)
continue
}
for _, consumer := range consumers {
subscriptionHandle.Register(consumer)
Expand Down

0 comments on commit 4c76916

Please sign in to comment.