handel nil context value in field.FromContext() func
@@ -10,9 +10,11 @@ const ctxKey = contextKey(43)
// FromContext returns the fields present in ctx if any
func FromContext(ctx context.Context) Fields {
+ if ctx != nil {
if s, ok := ctx.Value(ctxKey).(Fields); ok {
return s
}
+ }
return nil
}
