Skip to content

Commit

Permalink
fix npe
Browse files Browse the repository at this point in the history
  • Loading branch information
pacoxu committed Feb 28, 2022
1 parent 7000dba commit 2d0be26
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion github.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ func makeMdTable(data [][]string, header []string) string {
table.SetHeader(header)
table.SetBorders(tablewriter.Border{Left: true, Top: false, Right: true, Bottom: false})
table.SetCenterSeparator("|")
table.SetColWidth(300)
table.AppendBulk(data)
table.Render()
return tableString.String()
Expand All @@ -121,6 +122,13 @@ func makeReposString(repos []*github.Repository) string {
reposData := [][]string{}
for i, repo := range repos {
repoWithLink := fmt.Sprintf("[%s](%s)", *repo.Name, *repo.HTMLURL)
var description string
if repo.Description == nil {
description = *repo.Name
} else {
description = *repo.Description
}
// *description = strings.Replace(*description, "\n", "<br>", -1)
reposData = append(
reposData,
[]string{
Expand All @@ -129,7 +137,7 @@ func makeReposString(repos []*github.Repository) string {
(*repo.UpdatedAt).String()[:10],
(*repo.CreatedAt).String()[:10],
strconv.Itoa(*repo.ForksCount),
strings.Replace(*repo.Description, "\n", "<br>", -1),
description,
},
)
}
Expand Down

0 comments on commit 2d0be26

Please sign in to comment.