Skip to content

Commit b93d969

Browse files
authored
Merge pull request #65 from woehrl01/fix_type_panic
fix: don't panic if record received by fluentbit is invalid
2 parents 92ef537 + 736d195 commit b93d969

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

input/encoder.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
// limitations under the License.
1616
//
1717

18-
1918
package input
2019

2120
import (

output/decoder.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,10 @@ func GetRecord(dec *FLBDecoder) (ret int, ts interface{}, rec map[interface{}]in
8585
t := slice.Index(0).Interface()
8686
data := slice.Index(1)
8787

88-
map_data := data.Interface().(map[interface{}]interface{})
88+
map_data, ok := data.Interface().(map[interface{}]interface{})
89+
if !ok {
90+
return -3, 0, nil
91+
}
8992

9093
return 0, t, map_data
9194
}

0 commit comments

Comments
 (0)