Skip to content

Commit

Permalink
Merge pull request #1009 from skrashevich/fix-new-stream-error
Browse files Browse the repository at this point in the history
fix(streams): handle interface conversion panic in NewStream() at internal/streams
  • Loading branch information
AlexxIT committed Apr 29, 2024
2 parents fb756b7 + 1d59c02 commit 1682d18
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions internal/streams/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,13 @@ func NewStream(source any) *Stream {
}
case []any:
s := new(Stream)
for _, source := range source {
s.producers = append(s.producers, NewProducer(source.(string)))
for _, src := range source {
str, ok := src.(string)
if !ok {
log.Error().Msgf("[stream] NewStream: Expected string, got %v", src)
continue
}
s.producers = append(s.producers, NewProducer(str))
}
return s
case map[string]any:
Expand Down

0 comments on commit 1682d18

Please sign in to comment.