Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

handle nil values

  • Loading branch information...
commit 4f73b7db6edbecd66d6e7f5a39a8b69bbb1ba9fb 1 parent fca2d5a
@fabiokung authored
Showing with 4 additions and 0 deletions.
  1. +4 −0 json.go
View
4 json.go
@@ -72,6 +72,10 @@ func NewField(value interface{}) (Field, error) {
v = v.Elem()
}
+ if !v.IsValid() {
+ return nil, nil
+ }
+
switch v.Kind() {
case reflect.String:
return &String{S: value.(string)}, nil
Please sign in to comment.
Something went wrong with that request. Please try again.