Merge pull request #1009 from skrashevich/fix-new-stream-error

fix(streams): handle interface conversion panic in NewStream() at internal/streams
This commit is contained in:
Alex X
2024-04-29 06:20:41 +03:00
committed by GitHub
+7 -2
View File
@@ -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: