Skip to content

Commit

Permalink
Add nil check
Browse files Browse the repository at this point in the history
  • Loading branch information
ImDevinC committed Nov 22, 2023
1 parent a53466b commit e9289f4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func (jlp *jsonlogflattenerProcessor) flatten(ld *plog.Logs) error {
for j := 0; j < ld.ResourceLogs().At(i).ScopeLogs().Len(); j++ {
for k := 0; k < ld.ResourceLogs().At(i).ScopeLogs().At(j).LogRecords().Len(); k++ {
for l, m := range ld.ResourceLogs().At(i).ScopeLogs().At(j).LogRecords().At(k).Attributes().AsRaw() {
if reflect.TypeOf(m).Kind() == reflect.Map || reflect.TypeOf(m).Kind() == reflect.Slice {
if m != nil && (reflect.TypeOf(m).Kind() == reflect.Map || reflect.TypeOf(m).Kind() == reflect.Slice) {
payload, err := json.Marshal(m)
if err != nil {
jlp.logger.Error(err.Error())
Expand Down

0 comments on commit e9289f4

Please sign in to comment.