Skip to content

Commit

Permalink
Merge pull request #23 from projectdiscovery/issue-21-panic-due-to-ds…
Browse files Browse the repository at this point in the history
…tgen

fix nil check errors (#21)
  • Loading branch information
ehsandeep authored Mar 10, 2023
2 parents 483fc16 + 9267fe5 commit e328d9c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions cmd/docgen/dstdocgen/dst.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,9 @@ func process() error {
pkg: pkg,
structName: *structure,
})
structures = append(structures, main)
if main != nil {
structures = append(structures, main)
}
structures = append(structures, extra...)
}
if len(structures) == 0 {
Expand Down Expand Up @@ -424,7 +426,7 @@ func collectFields(s *structType, collectOpts *collectStructOptions) (fields []*
var foundStructures []*structType

for _, f := range s.node.Fields.List {
if f.Tag == nil && len(f.Names) > 0 {
if f.Tag == nil || len(f.Names) < 1 {
continue
}
tag := reflect.StructTag(strings.Trim(f.Tag.Value, "`"))
Expand Down

0 comments on commit e328d9c

Please sign in to comment.