Commit ba01b99
Neale Pickett
·
2025-12-30 14:59:34 -0500 EST
parent ed551e4
Fix nil pointer deref on unsigned commits
1 files changed,
+9,
-7
M
main.go
M
main.go
+9,
-7
| ... | ... | @@ -795,6 +795,9 @@ func (tw *TreeWalker) NewTreeItem(entry *git.TreeEntry, curpath string, crumbs [ | |
| 795 | 795 | Entry: entry, | |
| 796 | 796 | URL: tw.Config.getFileURL(tw.PageData.RevData, fname), | |
| 797 | 797 | Crumbs: crumbs, | |
| 798 | + | Author: &git.Signature{ | |
| 799 | + | Name: "unknown", | |
| 800 | + | }, | |
| 798 | 801 | } | |
| 799 | 802 | ||
| 800 | 803 | // `git rev-list` is pretty expensive here, so we have a flag to disable |
| ... | ... | @@ -808,15 +811,14 @@ func (tw *TreeWalker) NewTreeItem(entry *git.TreeEntry, curpath string, crumbs [ | |
| 808 | 811 | }) | |
| 809 | 812 | bail(err) | |
| 810 | 813 | ||
| 811 | - | var lc *git.Commit | |
| 812 | 814 | if len(lastCommits) > 0 { | |
| 813 | - | lc = lastCommits[0] | |
| 815 | + | lc := lastCommits[0] | |
| 816 | + | item.CommitURL = tw.Config.getCommitURL(lc.ID.String()) | |
| 817 | + | item.CommitID = getShortID(lc.ID.String()) | |
| 818 | + | item.Summary = lc.Summary() | |
| 819 | + | item.When = lc.Author.When.Format(time.DateOnly) | |
| 820 | + | item.Author = lc.Author | |
| 814 | 821 | } | |
| 815 | - | item.CommitURL = tw.Config.getCommitURL(lc.ID.String()) | |
| 816 | - | item.CommitID = getShortID(lc.ID.String()) | |
| 817 | - | item.Summary = lc.Summary() | |
| 818 | - | item.When = lc.Author.When.Format(time.DateOnly) | |
| 819 | - | item.Author = lc.Author | |
| 820 | 822 | } | |
| 821 | 823 | ||
| 822 | 824 | fpath := tw.Config.getFileURL(tw.PageData.RevData, fmt.Sprintf("%s.html", fname)) |