Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions gen/decoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,6 @@ func (g *Generator) genTypeDecoderNoCheck(t reflect.Type, out string, tags field
return fmt.Errorf("don't know how to decode %v", t)
}
return nil

}

func (g *Generator) interfaceIsEasyjsonUnmarshaller(t reflect.Type) bool {
Expand Down Expand Up @@ -514,11 +513,6 @@ func (g *Generator) genStructDecoder(t reflect.Type) error {
fmt.Fprintln(g.out, " for !in.IsDelim('}') {")
fmt.Fprintf(g.out, " key := in.UnsafeFieldName(%v)\n", g.skipMemberNameUnescaping)
fmt.Fprintln(g.out, " in.WantColon()")
fmt.Fprintln(g.out, " if in.IsNull() {")
fmt.Fprintln(g.out, " in.Skip()")
fmt.Fprintln(g.out, " in.WantComma()")
fmt.Fprintln(g.out, " continue")
fmt.Fprintln(g.out, " }")

fmt.Fprintln(g.out, " switch key {")
for _, f := range fs {
Expand Down
15 changes: 14 additions & 1 deletion tests/basic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,6 @@ func TestEncodingFlags(t *testing.T) {
t.Errorf("[%v] easyjson.Marshal(%+v) = %v; want %v", i, test.In, v, test.Want)
}
}

}

func TestNestedEasyJsonMarshal(t *testing.T) {
Expand Down Expand Up @@ -329,3 +328,17 @@ func TestNil(t *testing.T) {
t.Errorf("Wanted null, got %q", s)
}
}

func TestUnmarshalNull(t *testing.T) {
p := primitiveTypesValue

data := `{"Ptr":null}`

if err := easyjson.Unmarshal([]byte(data), &p); err != nil {
t.Errorf("easyjson.Unmarshal() error: %v", err)
}

if p.Ptr != nil {
t.Errorf("Wanted nil, got %q", *p.Ptr)
}
}
Loading