Check nil in RawJSON. (#45)

This commit is contained in:
Johan Sim Jian An 2018-03-23 12:08:22 +08:00 committed by Olivier Poitrey
parent be4b7c1474
commit 5250a1ba2d
1 changed files with 3 additions and 0 deletions

View File

@ -233,6 +233,9 @@ func (e *Event) Hex(key string, val []byte) *Event {
// No sanity check is performed on b; it must not contain carriage returns and // No sanity check is performed on b; it must not contain carriage returns and
// be valid JSON. // be valid JSON.
func (e *Event) RawJSON(key string, b []byte) *Event { func (e *Event) RawJSON(key string, b []byte) *Event {
if e == nil {
return e
}
e.buf = append(json.AppendKey(e.buf, key), b...) e.buf = append(json.AppendKey(e.buf, key), b...)
return e return e
} }