Skip to content

Commit

Permalink
fix: In P3Context.GenerateProto3MessagePartial, need to check for nil…
Browse files Browse the repository at this point in the history
… rinfo.Package .

Signed-off-by: Jeff Thompson <jeff@thefirst.org>
  • Loading branch information
jefft0 committed Nov 23, 2023
1 parent 127ce58 commit b746716
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions tm2/pkg/amino/genproto/genproto.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,12 @@ func (p3c *P3Context) GenerateProto3MessagePartial(p3doc *P3Doc, rt reflect.Type
p3msg.Name = info.Name // not rinfo.

var fieldComments map[string]string
if pkgType, ok := rinfo.Package.GetType(rt); ok {
p3msg.Comment = pkgType.Comment
// We will check for optional field comments below.
fieldComments = pkgType.FieldComments
if rinfo.Package != nil {
if pkgType, ok := rinfo.Package.GetType(rt); ok {
p3msg.Comment = pkgType.Comment
// We will check for optional field comments below.
fieldComments = pkgType.FieldComments
}
}

// Append to p3msg.Fields, fields of the struct.
Expand Down

0 comments on commit b746716

Please sign in to comment.