Skip to content

Commit

Permalink
fix: do not try to reset nil objects
Browse files Browse the repository at this point in the history
  • Loading branch information
kruskall committed Sep 14, 2023
1 parent cb44ee8 commit 9c89c01
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions features/pool/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ func (p *pool) message(message *protogen.Message) {
p.P(`}`)

p.P(`func (m *`, ccTypeName, `) ResetVT() {`)
p.P(`if m != nil {`)
var saved []*protogen.Field
for _, field := range message.Fields {
fieldName := field.GoName
Expand Down Expand Up @@ -89,6 +90,7 @@ func (p *pool) message(message *protogen.Message) {
p.P(`m.`, field.GoName, ` = `, fmt.Sprintf("f%d", i))
}
p.P(`}`)
p.P(`}`)

p.P(`func (m *`, ccTypeName, `) ReturnToVTPool() {`)
p.P(`if m != nil {`)
Expand Down

0 comments on commit 9c89c01

Please sign in to comment.