Skip to content

Commit

Permalink
fix: fix codegen crashing no description
Browse files Browse the repository at this point in the history
  • Loading branch information
haashemi committed Apr 4, 2024
1 parent ee327e5 commit 0fbba34
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions cmd/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,10 @@ func Parse(doc *goquery.Document) (data TemplateData) {
})

// Normalize the description
section.Description[0] = strings.Replace(section.Description[0], "This object", section.Name, 1)
section.Description[0] = strings.Replace(section.Description[0], "Use this method to", section.Name+" is used to", 1)
if len(section.Description) != 0 {
section.Description[0] = strings.Replace(section.Description[0], "This object", section.Name, 1)
section.Description[0] = strings.Replace(section.Description[0], "Use this method to", section.Name+" is used to", 1)
}

data.Sections = append(data.Sections, section)
})
Expand Down

0 comments on commit 0fbba34

Please sign in to comment.